Last active
March 6, 2024 16:50
-
-
Save caot/19b067d60c0049b52d047d2dae955239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. add USER-ID to the group docker | |
usermod -aG docker ${USER} | |
2. find out what groups you belong to | |
groups $USER | |
# gpasswd --delete root docker # Removing user root from group docker | |
docker stop `docker ps | grep {IMAGE NAME} | awk '{print $1}'` | |
docker ps -aq | |
docker stop $(docker ps -q) | |
docker system prune -a # can fix "no space left on device" | |
docker rm $(docker ps -aq) # Remove all containers | |
docker rm -f $(docker ps -a -q) | |
docker rmi $(docker images -q) # Remove all images | |
# Then use docker export to export the filesystem to tar: | |
docker export $(docker ps -lq) | tar tf - | |
# The docker ps -lq there means "give me the id of the most recent docker cotnainer". | |
# You could replace that with an explicit container name or id. | |
docker run --rm image-name ls -lrt / | |
-------- | |
# Delete all stopped containers | |
docker rm $( docker ps -q -f status=exited) | |
# Delete all dangling (unused) images | |
docker rmi $( docker images -q -f dangling=true) | |
-------- | |
xargs with --no-run-if-empty is even better as it does cleanly handle the case when there is nothing to be removed. | |
-------- | |
# Delete all stopped containers | |
docker ps -q -f status=exited | xargs --no-run-if-empty docker rm | |
# Delete all dangling (unused) images | |
docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi | |
docker exec -it $container /bin/bash -c "export TERM=xterm; exec bash" | |
docker container ls -a | |
docker start <container id> | |
# get rid of all untagged images | |
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}") | |
docker-machine create -d virtualbox node-1 | |
$ docker swarm init --advertise-addr $(docker-machine ip) | |
Swarm initialized: current node (mc13mvd41lgvx3amzihbt82g5) is now a manager. | |
To add a worker to this swarm, run the following command: | |
docker swarm join --token SWMTKN-1-16njjbj7b5lgtofpf07o4game4lmexez1dlyvdn74pldbgnhsf-5tgexd722dkb0cn3vot48a3qm 192.168.99.100:2377 | |
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions. | |
cpuset - confine processes to processor and memory node subsets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploying Gunicorn |
* Understand the risks of running out of memory
** How to mount windows folder using docker compose volumes?
fixed it in the following way: Local Security Policy --> Network List Manager Policies --> Double-clicked unidentified Networks -->
change the location type to private and restarted Docker.
ref: https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693/92
https://stackoverflow.com/questions/39467380/how-to-mount-windows-folder-using-docker-compose-volumes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
** Keep containers alive during daemon downtime | Keep Containers Alive
** Post-installation steps for Linux
** How to upgrade docker container after its image changed
* Understanding Docker Build Args, Environment Variables and Docker Compose Variables
example:
How to deploy Django with Docker
MySQL on Docker: Composing the Stack
MySQL on Docker: Running Galera Cluster on Kubernetes
Kubernetes vs Docker Swarm
docker cheat sheet
docker cheat sheet
docker.com cheat sheet
A Docker Cheat Sheet
https://github.com/caot/docker-cheat-sheet