26 July
2022
Docker Commands Cheat Sheet
run container
docker run
run container and drop to shell
docker run -it
docker run --interactive --tty
run container in background
docker run -d
container restart setings
docker run --restart (always|no|on-failure[:maxretries]|unless-stopped)
remove container when exited
docker run --rm
view containers running
docker container ls
docker container ls -a
start container
docker start
stop container
docker stop
remove container
docker rm
remove all stopped
docker container prune
rename container
docker rename
view containers metrics
docker stats []
copy file into container
docker cp file.ext :/path/to/folder/
view container information
docker inspect
Find container’s IP
docker inspect | grep IPAddress
Make a container an image
docker commit
Map container port to host port
docker run -p :