2

I want to use docker for development. I have projects which are somehow connected with each other - API calls between services.
Is it possible to have one generic Dockerfile for starting main project and its dependent projects?
Or maybe it is better to have Dockerfile in every of those projects and fire up them via docker-compose run separately?

Suppose I have projectMain, which calls projectA and projectB APIs to fullfil some operations.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Sebastian
  • 2,618
  • 3
  • 25
  • 32

1 Answers1

1

The docker approach is to have one process per container, instead of a collection of one, because of signal management (kill/stop).

You can use one giant container by building on top of phusion/baseimage-docker.

See "PID 1 zombie reaping issue": by declaring your script as a daemon, you will make sure the image handles the shutdown signal properly, and you can add as many "daemons" as you want in it.

But it is best (with docker 1.10 released in two weeks) to setup a user-defined network, and start your main project using links to aliases of your other containers, even if your other containers are not started yet.

See a concrete example in "Adding --link target to a running nginx container"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250