Skip to content

Instantly share code, notes, and snippets.

@marcelolebre
Last active November 19, 2018 07:29
Show Gist options
  • Save marcelolebre/8e040fe0a31c4889976bee68bbe0746f to your computer and use it in GitHub Desktop.
Save marcelolebre/8e040fe0a31c4889976bee68bbe0746f to your computer and use it in GitHub Desktop.
docker cheat sheet
# Connect to machine
eval $(docker-machine env machine-name)
# Clean docker images
docker rm $(docker images -q)
# Clean all docker images
docker rmi $(docker images -q)
# Clean docker containers /all
docker rm $(docker ps -a -q)
# Remove stopped containers
docker rm $(docker ps -a -q)
# Remove none images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
# CLI on container
docker exec -it dockerexample_app_1 /bin/bash
# Create Machine on MS Azure
docker-machine create --driver azure --azure-location "westeurope" --azure-resource-group "group-name" --azure-availability-set "availability-set-name" --azure-vnet "vnet-namg" --azure-subnet "subnet-name" --azure-subscription-id "ABC" name-of-the-vm
# Create Machine on Digital Ocean
docker-machine create --driver digitalocean --digitalocean-access-token=ABC --digitalocean-image=ubuntu-16-04-x64 --digitalocean-region=ams3 --digitalocean-size=8gb --digitalocean-private-networking=true --digitalocean-ssh-key-fingerprint=fingerprint-on-do name-of-the-vm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment