Cheatography
https://cheatography.com
Useful commands for our team on OS X
docker-machine (Work with Virtual Machine)create --driver driverName newMachineName | Create docker machine | create --driver virtualbox --virtualbox-memory 2048 memcrab | Create docker machine "memcrab" on virtualBox with 2048 mb RAM | start machineName | start virtualbox docker machine | stop machineName | stop docker machine | restart machineName | restart docker machine | rm machineName | remove docker machine. WARNING: will remove all containers, images and cache | env machineName | show current IP and all info | eval "$(docker-machine env machineName)" | Link terminal TAB to use current Docker machine on "docker" and "docker-compose" commands. Can be added to .bash_profile |
docker-compose (Use stack of Containers/Images)build | Build or rebuild all docker images from docker-compose.yml file | build nodejs | Build only one selected docker iage from docker-compose.yml file | up | Run containers from all docker images | up nodejs | Run containers from selected docker image | stop | Stop all composed containers | stop nodejs | Stop selected composed container |
docker (Use single Container/Image)run -it --rm imageName runCommandName | Run new container from image and delete it after finish command | exec -it containerName runCommandName | Execute some command on already running container and exit | exec -it containerName /bin/bash | Connect to already running container with terminal access | ps | Show running containers | ps -a | Show all containers | stop containerName | Stop container | start containerName | Start stopped container | rm containerName | Remove stopped container |
Some quick hacksdocker rmi $(docker images -f "dangling=true" -q) | Remove all unusable builds/images - free space on your hard drive | docker volume rm $(docker volume ls -qf dangling=true) | Remove all unusable shared volumes - free space on your hard drive |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets