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