Our first Dockerfile
Now that we know a little bit about how to get around containers, this is a good place to try out creating our own container. To start building a container, the first thing that we need to know is that the default filename that Docker looks for when building images is Dockerfile
. While you can use different names for this main configuration file, it is highly discouraged though in some rare cases, you might not be able to avoid it - if, for example, you need a test suite image and the main image build files in the same folder. For now, we will assume you just have a single build configuration, and with that in mind, how about we see what one of these basic Dockerfile
looks like. Create a test folder somewhere on your filesystem and put this into a file named Dockerfile
:
FROM ubuntu:latest RUN apt-get update -q && \ apt-get install -qy iputils-ping CMD ["ping", "google.com"]
Let's examine this file line by line. First, we have the FROM ubuntu:latest
line in...