4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

docker-composeで複数のコンテナをyamlファイルで管理し、最後にcowsayする

Last updated at Posted at 2015-09-09

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 |
                ||     ||

外部資料

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?