Compare commits
2 Commits
dd5ea5bcf2
...
120752e4a8
Author | SHA1 | Date | |
---|---|---|---|
|
120752e4a8 | ||
|
c5cd2cd671 |
@ -7,6 +7,6 @@ sudo docker-compose -f <file> up
|
|||||||
sudo docker-compose -f <file> up -d
|
sudo docker-compose -f <file> up -d
|
||||||
|
|
||||||
# Stops containers and removes containers, networks created by up
|
# Stops containers and removes containers, networks created by up
|
||||||
sudo docker-compose down
|
sudo docker-compose -f <file> down
|
||||||
|
|
||||||
$ file: ls *.yaml | awk '{print $1}'
|
$ file: ls *.yaml | awk '{print $1}'
|
||||||
|
@ -1,46 +1,34 @@
|
|||||||
% docker
|
% docker-volumes
|
||||||
|
|
||||||
# Remove an image
|
# Create a volume
|
||||||
docker image rm <image_id>
|
sudo docker volume create <name>
|
||||||
|
|
||||||
# Remove an image from the local image store
|
# List all volumes
|
||||||
docker rmi <image_id>
|
sudo docker volume ls
|
||||||
|
|
||||||
# Remove all images from the local image store
|
# Remove volume
|
||||||
docker rmi $(docker images -q) --force
|
sudo docker volume rm <volume>
|
||||||
|
|
||||||
# Remove all containers
|
$ volume: sudo docker volume ls --format "{{.Name}}" | awk '{print $1}'
|
||||||
docker rm $(docker ps -aq)
|
|
||||||
|
|
||||||
# Stop all containers
|
% docker-network
|
||||||
docker stop $(docker ps -aq)
|
|
||||||
|
|
||||||
# List all images that are locally stored with the Docker engine
|
# Create new network
|
||||||
docker images
|
docker network create <name>
|
||||||
|
|
||||||
# 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
|
|
||||||
docker stop <container_id>
|
|
||||||
|
|
||||||
# Stop a running container through SIGKILL
|
|
||||||
docker kill <container_id>
|
|
||||||
|
|
||||||
# List the networks
|
# List the networks
|
||||||
docker network ls
|
sudo docker network ls
|
||||||
|
|
||||||
|
% docker
|
||||||
|
|
||||||
# List the running containers
|
# List the running containers
|
||||||
docker ps
|
sudo docker ps
|
||||||
|
|
||||||
# Delete all running and stopped containers
|
# Stop a running container through SIGTERM
|
||||||
docker rm -f "$(docker ps -aq)"
|
sudo docker stop <container_id>
|
||||||
|
|
||||||
# Create a new bash process inside the container and connect it to the terminal
|
# Stop a running container through SIGKILL
|
||||||
docker exec -it <container_id> bash
|
sudo docker kill <container_id>
|
||||||
|
|
||||||
# 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
|
docker logs --tail 100 <container_id> | less
|
||||||
@ -48,13 +36,4 @@ docker logs --tail 100 <container_id> | 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
|
docker logs --tail 100 <container_id> -f
|
||||||
|
|
||||||
# Create new network
|
$ container_id: sudo docker ps --format "{{.ID}}" | awk '{print $1}'
|
||||||
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)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user