Building Images and Launching Apps

Learn to build an image and launch a live container from it.

Build Image

To build an image named nodehello from your Dockerfile, the following command is used:

docker image build -t nodehello .

📌 The period at the end of the command is essential. It references the application path. You can also use -f <file> if you didn’t name your build file “Dockerfile” e.g.,

docker image build -f Dockerfile.prod -t nodehello .

Practice

Click on the “Run” button to see how the image gets built. The build process could take several minutes as all steps are executed. Once the image is built successfully, run the below commands:

  1. List all images by:
    docker image ls
    
  2. List all hidden images by:
    docker image ls -a
    
  3. List the disk space occupied by Docker:
    docker system df
    

Get hands-on with 1200+ tech skills courses.