Skip to content

Instantly share code, notes, and snippets.

@alexlopes
Last active February 11, 2020 03:06
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 alexlopes/40b924cbe10d765aa1eec898dbd92aa6 to your computer and use it in GitHub Desktop.
Save alexlopes/40b924cbe10d765aa1eec898dbd92aa6 to your computer and use it in GitHub Desktop.
Docker Tricks

Run Docker without Sudo

Add the docker group if it doesn't already exist.

sudo groupadd docker

Add the connected user "${USERNAME}" to the docker group.

sudo gpasswd -a ${USERNAME} docker

Add your user to the docker group.

sudo usermod -aG docker $USER

Restart the docker daemon.

sudo service docker restart

Inspect

Docker IP

docker inspect  $(docker ps | grep mysql) | grep IPAddress

List IP Address

docker inspect --format '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(sudo docker ps -q)

Cleanup

Remove all stopped containers.

#This will remove all stopped containers by getting a list of all containers with docker ps -a -q and passing their ids to docker rm. This should not remove any running containers, and it will tell you it can’t remove a running image.
docker rm $(docker ps -a -q)

Remove all untagged images

#In the process of running docker I had accumulated several images that are not tagged. To remove these I use this command:
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
docker rmi $(docker images -q -f dangling=true)

Ionic

https://hub.docker.com/r/agileek/ionic-framework/

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