Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 1.97 KB

File metadata and controls

76 lines (55 loc) · 1.97 KB
author jessmjohnson
ms.author jejohn
ms.topic include
ms.date 08/07/2022

Step 1. At a shell prompt, confirm that Docker is accessible.

docker

If after running this command, you see help for the Docker CLI, then continue. Otherwise, make sure Docker is installed or your shell has access to the Docker CLI.

Step 2. Build the image.

The general form of the docker build command is:

 docker build --rm --pull \
  --file "<path-to-project-root>/Dockerfile" \
  --label "com.microsoft.created-by=docker-cli" \
  --tag "<container-name>:latest" \
  "<path-to-project-root>" 
 docker build --rm --pull `
  --file "<path-to-project-root>/Dockerfile" `
  --label "com.microsoft.created-by=docker-cli" `
  --tag "<container-name>:latest" `
  "<path-to-project-root>" 

For example, if you are at the root of the project directory, you can use a command like this:

docker build --rm --pull \
  --file "Dockerfile" \
  --label "com.microsoft.create-by=docker-cli" \
  --tag "msdocspythoncontainerwebapp:latest" \
  .
docker build --rm --pull `
  --file "Dockerfile" `
  --label "com.microsoft.create-by=docker-cli" `
  --tag "msdocspythoncontainerwebapp:latest" `
  .

Note the dot (".") at the end of the command referring to the current directly in which the command runs. You can add --no-cache to force a rebuild.

Step 3. Confirm the image was built.

Use the docker images command to return a list of images.

docker images

You should see images listed by REPOSITORY name, TAG, and CREATED date among other image characteristics.