Docker CheatSheet
docker run -d -P --rm --env MYSQL_ROOT_PASSWORD=my-secret-pw mysql
-d
will create a container with the process detached from terminal-P
will publish all the exposed container ports to random ports on the Docker host-env
is how you pass environment variables to the container--rm
will remove the container image on exitdocker ps // Default only shows running containers
docker ps -a // All running and exited containers
docker stop <containerName>
docker container update
docker exec -it <conatainer_name> bash
docker images
docker rmi <image>
docker pull <image>
docker build -t <tagName>
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker push learn/httpd_image
docker ps -q |xargs docker rm
docker images -q |xargs docker rmi
docker rm $(docker ps -a -f status=exited -q)
docker rmi -f <imageName>
docker system prune