Skip to content

Instantly share code, notes, and snippets.

@RichoDemus
Last active February 26, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RichoDemus/ebe6810e1a765e41b0d45f3585a14fb3 to your computer and use it in GitHub Desktop.
Save RichoDemus/ebe6810e1a765e41b0d45f3585a14fb3 to your computer and use it in GitHub Desktop.
Handy Docker things
docker save <image name> | ssh user@host 'docker load'
docker images | egrep "^<none>" | nawk '{ print $3 } ' | xargs docker rmi
docker system prune
# more: https://www.heavymetalcoder.com/shrink-your-virtual-hard-drive-file-in-docker-for-macos/
docker volume rm $(docker volume ls -qf dangling=true)
## OSX remove VM Disk since it doesn't auto-shrink
```
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls |awk '{print $2}')
rm -rf ~/Library/Containers/com.docker.docker/Data/*
```
# TODO clean this up:
richo@richo-lappy:~$ cat /etc/systemd/system/docker.service.d/richo.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:2375 -H fd://
# init.d:
echo 'DOCKER_OPTS="--dns 10.72.4.130 -H tcp://127.0.0.1:2375"' > /etc/default/docker
# systemd:
#make sure /etc/systemd/system/docker.service.d exists otherwise use mkdir to create it
printf "[Service]\nExecStart=\nExecStart=/usr/bin/docker daemon -H tcp://127.0.0.1:2375 -H fd:// \n" > /etc/systemd/system/docker.service.d/docker.conf
# Mac connect to docker VM
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment