Skip to main content

docker cheatsheet

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

Popular posts from this blog

Best freeware - XML editor

As a software developer, I open XML files all the time. I a heavy commercial XML editor. But nothing can compare to a small, thin and free XML editor like 'foxe'. A great feature is has is the alignment of long XML strings to readable XML format (Shift-F8). It help lot of times when the XML file was generated by some tool and was not readable. Homepage: http://www.firstobject.com/dn_editor.htm

Jenkins error: groovy.lang.MissingPropertyException

I tried to run groovy build step and got below error. This post will describe how I solved the problem. Caught: groovy.lang.MissingPropertyException: No such property: hudson for class: script

SSL in pictures

Here is my summary on SSL (or as I like to call it 'SSL for dummies')