docker image prune -a
docker ps
docker ps -a
Download a image from Docker Hub registry. Link to the docker image is always shown on the right at dockerhub.
docker pull
Build your own container based on a Dockerfile. Common use is docker build . to build a container based on the Dockerfile in the current directory (the dot). docker build -t "myimage:latest" . creates a container and stores the image under the given name
docker build
docker images
docker image ls
Run a docker container based on an image, i. e. docker run myimage -it bash. If no local image can be found docker run automatically tries to download the image from Docker hub.
docker run
Display the logs of a container, you specified. To continue showing log updates just use docker logs -f mycontainer
docker logs
docker volume ls
docker network ls
docker rm
Removes one or more images. docker rmi myimage, but make sure no running container is based on that image
docker rmi
Stops one or more containers. docker stop mycontainer stops one container, while docker stop $(docker ps -a -q) stops all running containers.
docker stop
docker start
docker update --restart=no
to copy files from a running container to the host or the way around. docker cp :/etc/file . to copy /etc/file to your current directory.
docker cp
- kill all running containers with docker
kill $(docker ps -q)
- delete all stopped containers with docker
rm $(docker ps -a -q)
- delete all images with docker
rmi $(docker images -q)
- update and stop a container that is in a crash-loop with docker
update --restart=no && docker stop
- bash shell into container
docker exec -i -t /bin/bash
** if bash is not available use /bin/sh
- bash shell with root if container is running in a different user context
docker exec -i -t -u root /bin/bash