| ms.topic | include |
|---|---|
| ms.date | 08/17/2022 |
Start in the root of the sample app you cloned or downloaded.
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>".
For example, if you are at the root of the project directory, you can use the command like this to build an image:
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.