Compare commits

..

2 Commits

Author SHA1 Message Date
Robin-Charles GUIHENEUF
dd5ea5bcf2 aliases: Add micro alias 2020-11-27 22:02:23 +01:00
Robin-Charles GUIHENEUF
38151d3ca7 navi: Add some cheat sheets 2020-11-27 22:02:23 +01:00
2 changed files with 48 additions and 27 deletions

View File

@ -7,6 +7,6 @@ sudo docker-compose -f <file> up
sudo docker-compose -f <file> up -d
# Stops containers and removes containers, networks created by up
sudo docker-compose -f <file> down
sudo docker-compose down
$ file: ls *.yaml | awk '{print $1}'

View File

@ -1,34 +1,46 @@
% docker-volumes
# Create a volume
sudo docker volume create <name>
# List all volumes
sudo docker volume ls
# Remove volume
sudo docker volume rm <volume>
$ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}'
% docker-network
# Create new network
docker network create <name>
# List the networks
sudo docker network ls
% docker
# List the running containers
sudo docker ps
# Remove an image
docker image rm <image_id>
# Remove an image from the local image store
docker rmi <image_id>
# Remove all images from the local image store
docker rmi $(docker images -q) --force
# Remove all containers
docker rm $(docker ps -aq)
# Stop all containers
docker stop $(docker ps -aq)
# List all images that are locally stored with the Docker engine
docker images
# Build an image from the Dockerfile in the current directory and tag the image
docker build -t <image>:<version> .
# Pull an image from a registry
docker pull <image>:<version>
# Stop a running container through SIGTERM
sudo docker stop <container_id>
docker stop <container_id>
# Stop a running container through SIGKILL
sudo docker kill <container_id>
docker kill <container_id>
# List the networks
docker network ls
# List the running containers
docker ps
# Delete all running and stopped containers
docker rm -f "$(docker ps -aq)"
# Create a new bash process inside the container and connect it to the terminal
docker exec -it <container_id> bash
# Print the last lines of a container's logs
docker logs --tail 100 <container_id> | less
@ -36,4 +48,13 @@ docker logs --tail 100 <container_id> | less
# Print the last lines of a container's logs and following its logs
docker logs --tail 100 <container_id> -f
$ container_id: sudo docker ps --format "{{.ID}}" | awk '{print $1}'
# Create new network
docker network create <network_name>
$ image_id: docker images --- --headers 1 --column 3 --delimiter '\s\s+'
$ container_id: docker ps --- --headers 1 --column 1 --delimiter '\s\s+'
% docker, boot
# Prevent all containers from autostarting on boot
docker update --restart=no $(docker ps -a -q)