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

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


Digital signature in pictures

I never remember what happens when digital signature is used. So here is my summary 'Digital signature for dummies'.