Ad space (banner)
AD

Got the fundamentals? A structured Docker course is a fast way to level up.

Find Docker courses on Udemy

Affiliate link. Costs you nothing extra.

🐳Docker Lessons
Lesson 33 / 45

Building an Image with docker build

When your Dockerfile is ready, use docker build. It reads the Dockerfile and produces an image.

The syntax is docker build -t name[:tag] .. The -t flag names the image, and the trailing . is the build context — the directory sent to the build.

Running docker build -t myapp . executes each instruction in order and finishes with an image tagged myapp:latest.

A common stumble is forgetting the trailing ., which produces a confusing error. That dot is the build context, not decoration.

In real work, this command runs in CI on every commit, producing the image that gets deployed.

Docker
Try it (type this into the pseudo terminal)
docker build -t myapp .

🧑‍💻 You can type this command into the Docker pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)