docker-composeで複数のコンテナをyamlファイルで管理、最後にcowsayします。
インストール
$ curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-`uname -s`-`uname -m` > docker-compose
$ sudo cp docker-compose /usr/local/bin/
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose -v
docker-compose version: 1.3.2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
docker-compose.yml
cowsay:
build: ./cowsay
command: cowsay hoge
figlet:
build: ./figlet
command: figlet hoge
cowsay/Dockerfile
FROM ubuntu:trusty
MAINTAINER tbpgr <tbpgr@tbpgr.jp>
RUN apt-get update
RUN apt-get install cowsay
figlet/Dockerfile
FROM ubuntu:trusty
MAINTAINER tbpgr <tbpgr@tbpgr.jp>
RUN apt-get update
RUN apt-get install figlet
docker-compose で一括build
$ docker-compose build
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
testdockercompose_figlet latest 154d5860affc 26 seconds ago 211.2 MB
testdockercompose_cowsay latest 8766e33b7dd5 30 seconds ago 210.5 MB
docker-compose で実行
$ docker-compose run cowsay
______
< hoge >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||