navi: Update docker sheet

This commit is contained in:
Robin-Charles Guihéneuf 2022-03-08 09:04:10 +01:00 committed by Robin-Charles GUIHENEUF
parent cb8eb77b60
commit f5757ad5ef

View File

@ -1,4 +1,4 @@
% docker-volumes % docker
# Create a volume # Create a volume
sudo docker volume create <name> sudo docker volume create <name>
@ -11,29 +11,36 @@ sudo docker volume rm <volume>
$ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}' $ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}'
% docker-network
# Create new network # Create new network
docker network create <name> docker network create <name>
# List the networks # List the networks
sudo docker network ls sudo docker network ls
% docker # Remove volume
sudo docker volume rm <network>
$ network: sudo docker network ls --format "{{.Name}}" | awk '{print $1}'
# List the running containers # List the running containers
sudo docker ps sudo docker ps
# Stop a running container through SIGTERM # Stop a running container through SIGTERM
sudo docker stop <container_id> sudo docker stop <container>
# Stop a running container through SIGKILL # Stop a running container through SIGKILL
sudo docker kill <container_id> sudo docker kill <container>
# Execute bash on a running container
sudo docker exec -it <container> bash
# Execute a command on a running container
sudo docker exec -it <container> sh -c '<command>'
# Print the last lines of a container's logs # Print the last lines of a container's logs
docker logs --tail 100 <container_id> | less sudo docker logs --tail 100 <container> | less
# Print the last lines of a container's logs and following its logs # Print the last lines of a container's logs and following its logs
docker logs --tail 100 <container_id> -f sudo docker logs --tail 100 <container> -f
$ container_id: sudo docker ps --format "{{.ID}}" | awk '{print $1}' $ container: sudo docker container ls --format "{{.Names}}" | awk '{print $1}'