-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Image Container Management from the Command Line
This section illustrates common use cases with a local Docker instance.
docker images python-webservice-demo*
This command assumes that all images were either created with the command docker compose up --build -d
or explicitly assigned the name python-webservice-demo
upon creation by docker build
.
Run the following command at the project root:
docker build -t python-webservice-demo:test .
An image on this project with name python-webservice-demo
and tag test
is created.
docker image rm python-webservice-demo:test
This command deletes the image with name python-webservice-demo
and tag test
.
The following example renames the image python-webservice-demo:test
to webservice-new-image:latest
.
- Create a new target image from the source image.
docker image tag python-webservice-demo:test webservice-new-image:latest
- Delete the source image (see above for the command).
docker container ls --all
docker container create -p 5000:5000 -e LOG_LEVEL=DEBUG --name python-ws-demo python-webservice-demo:test
This command publishes the container from image python-webservice-demo:test
to port 5000, setting environment variable LOG_LEVEL
to DEBUG
.
docker start python-ws-demo
This command starts the container with name python-ws-demo
.
docker stop python-ws-demo
This command stops the container with name python-ws-demo
.
docker container rm python-ws-demo
This command deletes the container with name python-ws-demo
.
- From Docker docs