Docker Cheatsheet
Building from dockerfile
In context of folder containing a file called Dockerfile
docker build .
Specify filename
docker build -f MyDockerfile .
Build with custom tag
docker build -f MyDockerfile -t my-service-image .
Starting and stopping
- docker start starts a container so it is running.
- docker stop stops a running container.
- docker restart stops and starts a container.
- docker pause pauses a running container, "freezing" it in place.
- docker unpause will unpause a running container.
- docker wait blocks until running container stops.
- docker kill sends a SIGKILL to a running container.
- docker attach will connect to a running container.
Clusters (docker-compose.yml)
docker-compose up --build -d
rebuilds the docker containers specified in the docker-compose.yml file and starts it as a daemon