watch 01:25
Jurassic World: Dominion Dominates Fandom Wikis - The Loop
Do you like this video?
Play Sound
Overview
- http://www.docker.com/
- Desc. : automates the deployment of Linux applications inside software containers.
- License :
- Written : Go
- Sources :
References
Docker 18
Instruction | Description | Remarks |
---|---|---|
EXPOSE <port> [<port>/<protocol>...] | informs Docker that the container listens on the specified network ports at runtime. |
Command-lines
- Docker Engine CLI (docker, dockerd)
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
- Dockerfile reference
docker run
reference- Use the Docker command line
- Docker Machine
- Get started with Docker Machine and a local VM
- Docker Machine command line reference
Readings
Boot2Docker
Events
- Docker Events
- Docker Events Explained (APR 14 2015)
Storage
- What is the (best) way to manage permissions for docker shared volumes (May 8 '14)
- boot2docker folder sharing
- What's the best way to share files from Windows to Boot2docker VM (Jun 16 '15)
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 ...
Networking
- Network containers
- Connect containers
- Is it possible to bind a container to multi networks? (6 Nov 2015)
- Network param for connecting to 127.0.0.1 in container (Jul '15)
- Customize the docker0 bridge
- Finally, the docker0 Ethernet bridge settings are used every time you create a new container. Docker selects a free IP address from the range available on the bridge each time you docker run a new container, and configures the container’s eth0 interface with that IP address and the bridge’s netmask. The Docker host’s own IP address on the bridge is used as the default gateway by which each container reaches the rest of the Internet.
- Networking your docker containers using docker0 bridge (May 23, 2016)
- Bridge the docker containers to external network(May 23, 2016)
- The docker-proxy (April 15th, 2015)
- Make it possible to disable userland proxy (Oct 2 2014)
- MANAGING PERSISTENCE FOR DOCKER CONTAINERS (23 Sep 2016)
- Storage Drivers in Docker: A Deep Dive (OCTOBER 1, 2016)
misc
- Docker Cheat Sheet
- Install Docker on Ubuntu
- Install Docker for Windows
- Move boot2docker and .docker folder in other drive (Oct 28 '15)
- Eclipse for Docker has arrived on Mars
- Stop / remove all Docker containers
- Running GUI apps with Docker(2014/09/11)
- Can you run GUI apps in a docker container?(Apr 30 '13)
- Setting up VNC fails (9 Jul 2015)
- docker-machine ip
- Where are Docker images stored? (12 december 2013)
- Where are docker images stored on the host machine?(Oct 7 '13)
- Running systemd within a Docker Container (May 5, 2014)
- Failed to get D-Bus connection: No connection to service manager - CentOS 7 (7 Aug 2014)
- HANDLING PERMISSIONS WITH DOCKER VOLUMES (2016-02-17)
- Docker, QML, XServer on Windows (17 Nov 2015)
- Running a GUI application in a Docker container(October 17, 2014)
- What are Docker <none>:<none> images? (16 July 2015)
docker rmi $(docker images -f "dangling=true" -q)
- Comparing Seven Monitoring Options for Docker (Apr 12, 2015)
- Docker exec - Write text to file in container (Feb 29 '16)
- docker exec -it ... bash -c "echo 'On a dark desert highway, ...' > ~/lyrics/hotel-california.txt"
- iptables sometimes works inside container, sometimes not - docker 0.8.1 (4 Mar 2014)
- running with -privileged option works ok everytime.
- Dynamic Zookeeper Cluster with Docker
- Slow IO performance inside container compared with the host. (25 Mar 2016)
- Best practices for writing Dockerfiles
- Absolute paths change with git bash on windows (28 Jun 2016)
- MSYS_NO_PATHCONV=1
- Using Docker containers as localhost on Mac/Windows
- A Docker Machine is a virtual machine running under VirtualBox in your host machine. We can use the Port Forwarding feature of VirtualBox in order to access the Docker VM as localhost.
Repositories
Images
- Dockerfiles
- WildFly
- Docker and WildFly Part 1 - Deployment via Docker volumes (Mar 02, 2015)
- WildFly Admin Console in a Docker image (January 5, 2015)
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
- https://docs.docker.com/compose/
- Desc. : a tool for defining and running multi-container Docker applications.
- Readings
Swarm Mode
Docker Machine
- https://github.com/docker/machine
- Desc. : lets you create Docker hosts on your computer, on cloud providers, and inside your own data center.
Docker Toolbox
- https://github.com/docker/toolbox
- Desc. : installs everything you need to get started with Docker on Mac OS X and Windows.
Readings
- Fixing Volumes in Docker Toolbox (Sep 6, 2018)
- How to use --volume option with Docker Toolbox on Windows? (Oct 14 '15)
Companions
Kubernetes
- http://kubernetes.io/
- Desc. : an open-source system for automating deployment, scaling, and management of containerized applications.
- License :
- Sources :
cAdvisor
- https://github.com/google/cadvisor
- Desc. : Analyzes resource usage and performance characteristics of running containers.
- License :
- Sources : https://github.com/google/cadvisor
- Readings
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)
or
$ 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
name=couchdb0
port=${COUCHDB_PORT:-5984}
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
[log]
file = /opt/couchdb/var/log/couch.log
writer = file
level = ${COUCHDB_LOG_LEVEL:-info}
HERE"
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 ""
fi