Containers are running instances of images. These commands allow you to manage their lifecycle.
View all currently active containers. #ps #ls
docker psView all containers, including stopped ones. #ps-all #all
docker ps -aCreate and start a new container from an image. #run #start-new
docker run $run_opts $imageRun a new command in an already running container. Often used to drop into a shell. #shell #bash #sh #attach
docker exec -it $container_running /bin/shStart a container that has been stopped. #boot #up
docker start $container_allGracefully stop a running container. #halt #shutdown
docker stop $container_runningStop and then start a container. #reboot
docker restart $container_runningForcefully terminate a running container immediately. #nuke #destroy #sigkill
docker kill $container_runningDelete a stopped container. Use --force to delete a running one. #rm #delete #purge
docker rm $rm_opts $container_allFetch the logs of a container. Useful for debugging. #logs #tail #debug
docker logs -f $container_allReturn low-level JSON information on a Docker container. #details #ip #json
docker inspect $container_allDisplay a live stream of container resource usage statistics (CPU, RAM). #top #htop #usage
docker statsExecute a command in a running container as the root user. Excellent for debugging permission issues or administering the container. #root #exec-root #admin #uid0
docker exec -u 0 -it $container_running /bin/bashRun a highly privileged container that mounts the host's entire root filesystem. This is useful for emergency debugging or administering the underlying Docker host. #admin #debug #host-mount #recovery
docker run --privileged --net=host --pid=host -v /:/mnt/root -it $image /bin/bashCreate a new image from a container's changes. Useful if you've manually installed packages and want to save the state. #save #snapshot #backup
docker commit $container_all $new_image_nameExport a container's filesystem as a tar archive. #export #tar #extract
docker export -o $export_file $container_allCopy files or folders between a container and the local filesystem. #cp #copy #extract
docker cp $directionInspect changes to files or directories on a container's filesystem since it was created. #diff #changes #modified
docker diff $container_allList port mappings or a specific mapping for the container. #port #netstat #bindings
docker port $container_runningRename a container. #rename #mv
docker rename $container_all $new_nameUpdate the resource limits of one or more containers dynamically without restarting them. #limits #cpu #memory #update
docker update $update_opts $container_runningSuspend all processes within a container. #pause #suspend #freeze
docker pause $container_runningResume all processes within a paused container. #unpause #resume #unfreeze
docker unpause $container_paused