Setting up a Basic Docker App Using Compose

With Docker you can build and deploy your web applications with ease. docker-compose in particular helps you easily compose your application out of various standard web components. It also lets you scale your app using swarm. You can even do fancy things with embedded hardware:

So suppose you have a docker-compose.ymlfile that looks a bit like this:

  build: .
  image: postgres

then, when you run

docker-compose up -d

your app boots up and is running. You even have storage persistence since most database images use Docker data volumes to store their content in - so you won't lose anything across container restarts.

It's also easy to setup. Just put a docker-compose.yml file in the root of your project repository, configure it correctly and you're done. You have included an environment in which your app is deployable and runs without installing anything besides Docker (or Docker Toolbox)

I have found that basing your app on Docker or even dockerizing an existing app makes it way easier to move apps across different hosts (if that is something you are interested in). It makes dependency management a lot easier since you have one file defining everything. No need for lengthy README files detailing how to setup the app. Just look at the included docker-compose.yml and you can see how the app is built and run.

For more information have a look at: