
Hello there!
Here are few Docker maintenance commands.
image commandsdocker image ls
- lists docker images.docker images -aq -f 'dangling=true' | xargs docker rmi
- removes all unused images.docker rmi imageId
- remove an image.docker rmi -f imageId
- force remove an imagedocker rmi -f $(docker images -q)
- deletes all images forcefully.
instance commandsdocker ps
- lists running docker instances.docker ps -a
- lists docker instances (including stopped).docker stop containerId
- stops the container (proper shutdown).docker kill containerId
- stops the container (not gracefully shutdown).docker rm containerId
- remove a stopped container.docker rm $(docker ps -a -q)
- removes all stopped containers.
execution commandsdocker exec -it containerName /bin/bash
- Use this to interact with already running container.docker run -it --entrypoint=/bin/bash containerName
- Starts the docker and lands user in shell.docker logs -t containerName
- shows logs even for container with exited status.
Image byAlexander Fox | PlaNet Fox fromPixabay
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse