navi: Update docker sheet
This commit is contained in:
parent
57c74103dd
commit
d6588e34f6
@ -1,4 +1,4 @@
|
||||
% docker-volumes
|
||||
% docker
|
||||
|
||||
# Create a volume
|
||||
sudo docker volume create <name>
|
||||
@ -11,29 +11,36 @@ 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
|
||||
# Remove volume
|
||||
sudo docker volume rm <network>
|
||||
|
||||
$ 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 <container_id>
|
||||
sudo docker stop <container>
|
||||
|
||||
# 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
|
||||
docker logs --tail 100 <container_id> | less
|
||||
sudo docker logs --tail 100 <container>
|
||||
|
||||
# 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}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user