# get id of active containers
docker ps
docker ps -a # get all containers
docker stop <the-container-id>
docker rm <the-container-id>
# stop and remove
docker rm -f <the-container-id>
# create new tag from existing tag
docker tag myapp:latest myapp:v1.0.0
# remove tag
docker rmi myapp:v1.0.0
# remove specific imageId
docker rmi <imageId>
# remove all dangling images (with <none> tag)
docker image prune
# execute arbitary commands in a running container
docker exec <container-id> <command>
# run interactive commands in a running container
docker exec -it <container-id> bash
# list all images
docker image ls
docker images
# get history of a docker image
docker history --no-trunc <image-id> > image-id-history.txt
# run interactive bash on an image id
docker run -it --entrypoint=/bin/bash <name-of-image/image-id>
# Removes all stopped containers.
docker container prune
# remove all stopped containers, unused networks, dangling images, dangling build-cache
docker system prune
# add all volumes not used, all images with no container associated, all build cache
docker system prune -a --volumes
# list all local volumes
docker volume ls
# inspect a specific volume, to get the exact physical location
docker volume inspect volume_name
# docker copy file to volume (that has attached container)
docker cp SRC container_name:DEST
# docker disk upsage
docker system df # add -v option for more details
docker run -e "JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n" -p 8080:8080 -p 5005:5005 -t mycontainer