Hacker News new | ask | show | jobs
by ilaksh 4532 days ago
You can package all of your apps dependencies in one image and have a script in the container start them.
1 comments

Yes you can but I don't think that's the philosophy behind Docker.

To expand on the "dependencies" idea of my previous post, although you technically can put a process supervisor, a web server, an application server, and a database in the same container, this is not the best practice. It makes your app simpler to distribute (a single image, no orchestration) but harder to evolve (e.g. move the database to its own physical server, or replicate it and put them behind a connection pooler).

For instance if you have a tool to manage a cluster of containers, you will be able to manage the different processes/containers logs in a repeatable way.

But sure, if you know you don't need the added flexibility, you can put everything you want in the same image.

There are several use-cases for docker, and they could use different docker images and containers. Right now there's no easy way to distinguish all-in-one image from one-process images.

Seems like the "docker way" is the one-process-image. But one use-case that I find entertaining is to use docker as an super simple way of trying out software. For example I ran Wordpress for 10 minutes just to check it out. In that case it makes sense to have everything in one container as it makes it much easier to run. But in production it might not be a good idea, especially if the app is not totally self contained.