Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines.
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features.
$ sudo apt install docker-composedocs.docker.com/compose/install
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose$ docker-compose --versionLet's say you have two containers you would like to deploy. You have two custom commands, these two for example.
Container 1, memcached
$ docker run --name memcached_yopass -d memcachedContainer 2, yopass (yopass is real nice btw, thanks @jhaals)
$ docker run -p 1337:1337 --link memcached_yopass:memcache -d jhaals/yopass --memcached=memcache:11211To deploy both containers in a compose, create docker-compose.yml and win.
version: '2.0'
services:
memcached:
restart: always
image: "memcached"
ports:
- "11211:11211"
yopass:
restart: always
image: "jhaals/yopass"
ports:
- "1337:1337"
command: "--memcached=memcached:11211"
To deploy compose-file, run
$ docker-compose up -dIt's that easy.