Docker 18

Instruction Description Remarks
EXPOSE <port> [<port>/<protocol>...] informs Docker that the container listens on the specified network ports at runtime.


Command-line Description Options Remarks
docker run Run a command in a new container --detach(-d), --interactive(-i), --tty(-t), --volume(-v), --publish(-p), --rm, --env, --env-file
docker kill Kill one or more running containers
docker rm Remove one or more containers
docker exec Run a command in a running container --interactive(-i), --tty(-t), --detach(-d)
docker logs Fetch the logs of a container --details, --follow(-f), --tail
docker cp Copy files/folders between a container and the local filesystem

Docker 1.11





mkdir c:\var
"%VBOX_MSI_INSTALL_PATH%\VBoxManage" sharedfolder add default --name c/var --hostpath c:\var --automount
docker-machine ssh default sudo mkdir /c/var
docker-machine ssh defalut sudo mount -t vboxsf -o uid=1000,gid=50 c/var /c/var

docker run -v /c/var/opt:/var/opt:rw ...





Software Docker Image Remarks
OpenSSH on Ubuntu https://hub.docker.com/r/rastasheep/ubuntu-sshd/ Dockerized SSH service, built on top of official Ubuntu images
CentOS systemd https://hub.docker.com/r/centos/systemd/ systemd enabled base container
InfluxDB https://hub.docker.com/r/tutum/influxdb/
WordPress https://hub.docker.com/r/_/wordpress/
Redis https://hub.docker.com/_/redis/
MongoDB https://hub.docker.com/_/mongo

Docker Compose

Swarm Mode

Docker Machine

Docker Toolbox




  • http://kubernetes.io/
  • Desc. : an open-source system for automating deployment, scaling, and management of containerized applications.
  • License :
  • Sources :


Tips and Tricks

Identifying versions of Docker Engine, Docker Compose and Docker Machine

To indentify Docker Engine version

$ docker version --format '{{.Server.Version}}'

To identify Docker Compose version

$ docker-compose version

To identify Docker Machine version

$ docker-machine version

For more, refer the followings

Removing all containers in a single command-line

If there's no running container, just use

$ docker rm $(docker ps -a -q)

If there's running containers also, use one of the followings

$ docker rm -f $(docker ps -a -q)


$ docker stop $(docker ps -q)
$ docker rm $(docker ps -a -q)

Shell login to running docker container

In the following command line hyperledger_vp0_1 is the name of container to access.

$ docker exec -it hyperledger_vp0_1 /bin/bash

Inspect low-level information of container including configuration

$ docker inspect hyperledger_vp0_1

Inject configuration file into container deferring the built-in command

In the following example, hyperledger/fabric-couchdb's built-in command (/opt/couchdb/bin/couchdb) is deferred by being overriden at docker run command. The configuration file is injected using docker exec command with here-documents and then built-in command (/opt/couchdb/bin/couchdb) starting CouchDB is executed in another docker exec command.

#! /bin/bash

# For more on CouchDB configuration, refer
#   -http://docs.couchdb.org/en/2.0.0/config/
#   -http://docs.couchdb.org/en/2.0.0/config-ref.html : CouchDB configuration reference


sudo rm -rf ~/docker/opt/couchdb/$name

docker run -itd \
--name $name \
-p $port:5984 \
-v ~/docker/opt/couchdb/$name/data:/opt/couchdb/data \
-v ~/docker/opt/couchdb/$name/var/log:/opt/couchdb/var/log \
hyperledger/fabric-couchdb /bin/bash

echo "Waiting 2 seconds for CouchDB to be launched completely."
sleep 2

docker exec -it $name bash -c "cat >> /opt/couchdb/etc/local.d/docker.ini << HERE
file = /opt/couchdb/var/log/couch.log
writer = file
level = ${COUCHDB_LOG_LEVEL:-info}

echo "Waiting 2 seconds for 'docker exec' to be completed."
sleep 2

docker exec -itd $name "/opt/couchdb/bin/couchdb"

if [ $? -eq 0 ]; then
  echo ""
  echo "CouchDB container named '$name' has launched successfully."
  echo "Access 'http://localhost:$port/_utils' to manage $name."
  echo "Data files : '~/docker/opt/couchdb/$name/data' in host filesystem."
  echo "Log files  : '~/docker/opt/couchdb/$name/var/log' in host filesystem."
  echo ""

Community content is available under CC-BY-SA unless otherwise noted.