Short docker commands list (in table view):
Images
What | How |
---|---|
List local images | docker images |
Delete local image | docker rmi NAME |
Download image | docker image pull NAME |
Create container from image (detached) | docker run –d … |
Display information on image | docker image inspect hpsoftware/almoctane |
Containers
What | How |
---|---|
List of running docker containers | docker ps |
List all docker containers (running and stopped) | docker ps -a |
Start existing container | docker start ID |
Stop contianer | docker stop ID |
Create container, start it and get a shell inside of it | docker run -it IMAGE bash |
Run a command inside of an already running container | docker exec -it ID bash |
Delete container | docker rm ID |
Get log | docker logs ID |
Other
What | How |
---|---|
Create virtual network | docker create network octane_nw |
Start docker service | systemctl start docker |
Define proxy | mkdir -p /etc/systemd/system/docker.service.d vi /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://proxy.il.hpecorp.net:8080/“ sudo systemctl daemon-reload sudo systemctl restart docker |
Docker-compose
What | How |
---|---|
Install | curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version |
Get images | docker-compose pull |
Create all containers (-d = detach) | docker-compose up –d |
Stop / start all containers | docker-compose stop / start |
Delete all containers | docker-compose down |
Compose status | docker-compose ps |
Remove stopped containers | docker-compose rm |
Logs from all containers | docker-compose logs |
Comments