Skip to content

Instantly share code, notes, and snippets.

@colormono
Last active May 14, 2021 21:29
Show Gist options
  • Save colormono/0ccabce3eee641de6b12d9bf45cd8a67 to your computer and use it in GitHub Desktop.
Save colormono/0ccabce3eee641de6b12d9bf45cd8a67 to your computer and use it in GitHub Desktop.
[Docker] #CLI
# create and start containers
docker-compose up
# start services with detached mode
docker-compose -d up
# start specific service
docker-compose up <service-name>
# list images
docker-compose images
# list containers
docker-compose ps
# start service
docker-compose start
# stop services
docker-compose stop
# display running containers
docker-compose top
# kill services
docker-compose kill
# remove stopped containers
docker-compose rm
# stop all contaners and remove images, volumes
docker-compose down
# start docker compose
docker-compose up --build
# end docker compose
docker-compose down
# lists running containers.
docker ps
# download a particular image
docker pull
# builds Docker images from a Dockerfile and a “context”
docker build -t my_container .
# run a docker container
docker run my_image -it bash
# display the logs of a container
docker logs --follow my_container
# lists the volumes
docker volume ls
# removes one or more containers
docker rm my_container
# removes one or more images
docker rmi my_image
# stops one containers
docker stop my_container
# stops all running containers
docker stop $(docker ps -a -q)
# kill one running container
# kill does not attempt to shut down the process gracefully first
docker kill my_container
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment