Skip to content

Instantly share code, notes, and snippets.

@caot
Last active March 6, 2024 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caot/19b067d60c0049b52d047d2dae955239 to your computer and use it in GitHub Desktop.
Save caot/19b067d60c0049b52d047d2dae955239 to your computer and use it in GitHub Desktop.
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
Deploying Gunicorn
@caot
Copy link
Author

caot commented Jan 4, 2018

* 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

@caot
Copy link
Author

caot commented Feb 21, 2018

@caot
Copy link
Author

caot commented Feb 22, 2018

@caot
Copy link
Author

caot commented Apr 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment