.dotfiles/navi/docker.cheat

40 lines
824 B
Plaintext
Raw Normal View History

2020-11-21 09:07:54 +00:00
% 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
# Stop a running container through SIGTERM
sudo docker stop <container_id>
# Stop a running container through SIGKILL
sudo docker kill <container_id>
# Print the last lines of a container's logs
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}'