docker_cheatsheet
docker-compose port/volume host / container syntax:
host_port:container_port , host_volume:container_volume
list all running containers
docker ps -a
command line in a running container
docker exec -it <containerID> bash
stop all running containers
docker stop $(docker ps -a -q)
rm all running containers
docker rm $(docker ps -a -q)
list all docker images
docker images
remove specific docker images:
docker rmi <image1> <image2>
copy file from current directory to running container
docker cp foo.txt containerID:/foo.txt
update all docker images (even if they are not running)
for image in $(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v '<none>'); do docker pull $image; done;
Free extra space with a prune:
docker system prune --all --force --volumes
To remove dangling / old images that are just taking up space:
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
Remove all exited containers:
docker rm $(docker ps -a -f status=exited -q)
Kubernetes K3S
Start K3s Service:
systemctl start k3s.service
Stop K3s Service:
systemctl stop k3s.service