Learn How To Create A Docker Image In 162 Seconds

By Lukas Aichbauer and Ivan Popovic | March 14, 2024 | 3 min watch time

Description

Learn all the commands needed to create your first Docker Image in 162 seconds.

Learning outcomes

  • What is a Docker Image?
  • How do I create my first Docker Image?
  • What commands do I need?
  • How do the commands work together?
  • How do Tags work?
  • How do I keep my Registry clear?

Commands You Will Learn

docker build . – build an image out of a Dockerfile located in the current Docker build context . and stores it in the local registry

--file <path-to-dockerfile> – add this flag to theĀ docker build command when your Dockerfile is not located in the current Docker build context or named differently than Dockerfile (e.g., Dockerfile.server)

--tag <user-name>/<repository-name>:<version> – add this flagĀ  to the <code>docker build</code> command when you want to give your image a unique name (e.g., examplename/examplerepository:0.1.0)

docker image ls – list all images in your local registry

docker image rm <image-name/image-id> – delete an image from your local registry