| author | jess-johnson-msft |
|---|---|
| ms.author | jejohn |
| ms.topic | include |
| ms.date | 07/07/2022 |
Step 1. At a shell prompt, confirm that Docker is accessible.
docker
If after running this command you 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 "msdocspythondjangocontainerwebapp:latest" \
.
docker build --rm --pull `
--file "Dockerfile" `
--label "com.microsoft.create-by=docker-cli" `
--tag "msdocspythondjangocontainerwebapp:latest" `
.
If you started with the Flask version of the sample app, then use "msdocspythonflaskcontainerwebapp" as the tag name. Note the dot (".") at the end of the command. 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.