Useful Docker Commands Docker cheatsheet - Davz33/tutorials GitHub Wiki
This logo belongs to Docker Inc., which owns all legal rights thereof.
docker ps
docker ps -a
docker rename oldname newname
docker container pause <container ID or NAME>
docker run -it -d author/dockername /bin/bash
Note the -d
option, which stands for detached: this means that the command you run the container with (/bin/bash
), will run in the background so that the container will live through the termination of the current shell session.
docker exec -ti <name of the container> /bin/bash
warning: make sure to save configurations and apps you'll need again before stopping your container.
You should have either
- stored those on container locations mapped to host via volumes flags (
-v path:path
) - saved the entire state of the container to a docker image via
docker commit
docker container stop <container ID or NAME>
docker image ls
docker tag OldName:tag NewName:tag
- List containers first
docker ps
- Take note of the container id , then :
docker inspect -f '{{ .Mounts }}' containerid