From the course: Learning Docker

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Create a Docker container from Dockerfiles, part 2

Create a Docker container from Dockerfiles, part 2 - Docker Tutorial

From the course: Learning Docker

Create a Docker container from Dockerfiles, part 2

- [Instructor] Now that we've seen an example Dockerfile, let's turn it into a Docker image and start our container from it. We're going to use the docker build command to do this. Let's look at its help documentation first. Just like docker run, we have lots of options to choose from. For this example though, the only option that we'll need is the tag option. Just like containers, every Docker image has an ID. This option associates a convenient name with that ID. This way, we don't have to remember the image ID whenever we use it. So going back to our docker build command, let's call it our-first-image to keep things simple. Dockerfile looks for a file called Dockerfile by default. Since this is what our dockerfile is actually called, we don't need to change anything. However, if our Dockerfile were called something else like say app.Dockerfile, we would need to provide the dash f or dash dash file options as well so…

Contents