From the course: Docker for Developers: Create and Manage Docker Containers
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Using the docker build command - Docker Tutorial
From the course: Docker for Developers: Create and Manage Docker Containers
Using the docker build command
- [Instructor] Now that our Docker file is in place, we can build our custom image. Open a terminal in VS Code and type the "Docker build" command. This tells Docker to start building an image, then type the T flag and the name "Docker-demo," which assigns a tag to the image. This makes it easier to reference later. Then add a period at the end, which means use the current folder as the build context. Docker will then read the Docker file line by line. It'll download the base image if it doesn't exist locally, copy your app files, install dependencies, and prepare your app to run. If you want to make sure Docker rebuilds everything from scratch, which is useful when testing changes, add the "no cache" flag. Type "Docker build," two hyphens, and "no-cache." Then tag the image "Docker-demo" and add a period at the end. This skips Docker's layer cache, which can help prevent old files or dependencies from sneaking in.…
Contents
-
-
-
-
-
(Locked)
Finding and pulling Docker images2m 39s
-
(Locked)
Writing a Dockerfile3m 23s
-
(Locked)
Using the docker build command2m 2s
-
(Locked)
Listing, inspecting, and removing images3m 4s
-
(Locked)
Working with an image repository2m 53s
-
(Locked)
Challenge: Building a custom image1m 4s
-
(Locked)
Solution: Building a custom image1m 38s
-
(Locked)
-
-
-
-
-
-