免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年2月22日 星期日

fig.yml for docker


//=== http://www.fig.sh
install fig ( Fast, isolated development environments using Docker )

$ sudo curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig
or
$ sudo pip install -U fig [ as a Python package ]

$ fig --version


//=== http://www.fig.sh/yml.html

example fig.yml to build two docker images
[
. is the cwd(current working directory) where fig.yml is located;
./mywebApp is the nodejs app folder where a Dockerfile must exist to build docker image;
./mydb is the database folder where a Dockerfile must exist to build docker image;
]

*** .dockerignore file cannot include 'Dockerfile' !!!
otherwise, fig build will fail with message 'Can't build a directory with no Dockerfile'
although docker build still succeed.


web:
build: ./mywebApp/
command: node app.js
volumes:
- ./mywebApp:/usr/src/app
links:
- db:db_alias
ports:
- "80:3000"

db:
build: ./mydb/
ports:
- "27017:27017"




-->
$ fig rm [ removes containers ]
$ fig build [ rebuild images ]
$ fig up [ run whole setup again ]




*** https://github.com/docker/fig/issues/832

[the correct format]
volumes:
- ./mywebApp:/usr/src/app


[the wrong format]
volumes:
- ./mywebApp: /usr/src/app
the white space after ':' will fail the build




//===
more fig.yml examples for docker
http://blog.docker.com/tag/fig/
http://www.syncano.com/docker-workflow-fig-sh/

"""...
Fig is a python application that helps you run groups of docker containers.

...
The docker command line interface is awesome, but if you start working with
many containers at once and link them in the development environment,
typing the commands into the command line gets burdensome.

...
The most pragmatic approach to this problem is creating a bash script ...
..."""

--> use 'fig' to simplify the co-working of multiple containers.


沒有留言:

張貼留言