[ ubuntu ] docker compose : multi-container Docker applications in an isolated environment


Compose has commands for managing the whole lifecycle of your application:

  • Start, stop and rebuild services
  • View the status of running services
  • Stream the log output of running services
  • Run a one-off command on a service

Hello world

1) ./docker-compose.yml

version: '2'
   build: .
     - "5000:5000"
     - .:/code
     - logvolume01:/var/log
     - redis
   image: redis
     - logvolume01: {}


  • services : image_name
  • image : image_name
  • restart
restart: always


  • ports mapping : `HOST:CONTAINER`
 - "9999:22"

NOTE: this can also be mapped when docker is run

Example :

 docker run -p 8888:800 tomcat:1.8.0 

Access from outside world http://localhost:8888


  • volumes: `HOST:CONTAINER`
  - .:/code
  - logvolume01:/var/log

​options ​​–volume in docker run may works as well


  • extra_hosts
 - "docker:"

This will be created in `/etc/hosts` inside containers      docker


Compose file reference



Another example 

version: '3'

build: .
- mongo
- '4000:4000'
- ./:/var/www/app

image: mongo:4.0
restart: always
- mongo-data:/data/db
- '27017:27017'
command: --smallfiles

image: mongo-express:0.49.0
restart: always
- mongo
- '8081:8081'



2) docker-compose up

$ docker-compose up -d


up v.s. run v.s. start

$ docker-compose up
  • use up to start or restart all the services defined in a docker-compose.yml
  • When runs, if it finds any containers from previous runs, it copies the volumes from the old container to the new container. This process ensures that any data you’ve created in volumes isn’t lost

can use json instead of yaml

$ docker-compose -f docker-compose.json up


$ docker-compose run
  • use for running “one-off” or “adhoc” tasks. It requires the service name you want to run and only starts containers for services that the running service depends on. Use run to run tests or perform an administrative task such as removing or adding data to a data volume container. The run command acts like docker run -ti in that it opens an interactive terminal to the container and returns an exit status matching the exit status of the process in the container.


$ docker-compose start
  • use to restart containers that were previously created, but were stopped ( docker-compose stop ). It never creates new containers.


down v.s. stop v.s. remove

$ docker-compose down
  • Stops containers + removes containers, networks, volumes, and images created by up

By default, the only things removed are:

  • Containers for services defined in the Compose file
  • Networks defined in the networks section of the Compose file
  • The default network, if one is used

Networks and volumes defined as external are never removed


$ docker-compose stop
  • Stops running containers without removing them


$ docker-compose rm
  • Removes stopped service containers

By default, anonymous volumes attached to containers will not be removed. You can override this with -v. To list all volumes, use docker volume ls

Any data which is not in a volume will be lost

Running the command with no options will also remove one-off containers created by docker-compose up or docker-compose run


Compose command line reference



Build Images

docker build -t web .




Control startup order






  1. Multiple isolated environments on a single host

Compose uses a project name to isolate environments from each other. You can make use of this project name in several different contexts:

  • dev host, to create multiple copies of a single environment (e.g., you want to run a stable copy for each feature branch of a project)
  • CI server, to keep builds from interfering with each other, you can set the project name to a unique build number
  • on a shared host or dev host, to prevent different projects, which may use the same service names, from interfering with each other
    The default project name is the basename of the project directory. You can set a custom project name by using the -p command line option or the COMPOSE_PROJECT_NAME environment variable

2. Preserve volume data when containers are created

This process ensures that any data you’ve created in volumes isn’t lost.

3. Only recreate containers that have changed

4. Variables and moving a composition between environments

Compose supports variables ( https://docs.docker.com/compose/compose-file/#variable-substitution ) in the Compose file. You can use these variables to customize your composition for different environments, or different users. See Variable substitution for more details.

You can extend a Compose file using the extends field or by creating multiple Compose files. See extends ( https://docs.docker.com/compose/extends/ ) for more details.


Common Use Cases

  1. Development environments

Compose can reduce a multi-page “developer getting started guide” to a single machine readable Compose file and a few commands.

2. Automated testing environments

Compose provides a convenient way to create and destroy isolated testing environments for your test suite. By defining the full environment in a Compose file you can create and destroy these environments in just a few commands

$ docker-compose up -d
$ ./run_tests
$ docker-compose down

3. Single host deployments

You can use Compose to deploy to a remote Docker Engine. The Docker Engine may be a single instance provisioned with Docker Machine ( https://docs.docker.com/machine/overview/ ) or an entire Docker Swarm cluster ( https://docs.docker.com/swarm/overview/ ).

More detail : https://docs.docker.com/compose/production/




[Gimp] CMYK Separate+ plugin on ubuntu


Download RGB and CMYK profile on adobe’s website.



Separate+ will be in gimp-plugin-registry that can be installed by using the following command.

$ sudo apt-get install gimp-plugin-registry

Installation verification

Separate binary file will be in /usr/lib/gimp/2.0/plug-ins.


or in whatever plugin directory specified in Edit > Preferences


After restart gimp, the separate+ menu will be at Image > Separate


Image > Separate > Separate


Then we will got the ugly B/W image.

At that image, run

Image > Separate > Proof


then we will got the nice CMYK image.

facebook api version

  1. api shown in app setting page is the oldest version that that app can use


2. app can request to multiples version, but cannot request to the version that is older than the API version shown in the app setting.

3. An upgrade testing can be set in the app setting


ref : https://developers.facebook.com/docs/apps/versions