0

Used docker-compose to dockerized a web application. It includes app/db.

I separated the images from app/db and put them into docker-compose.yml file.

So run $ docker-compose build can build all the images. And run $ docker-compose up can start all the container services.

But, I want to make a hole image like $ docker build -t app ., how to run it?

I tried $ docker run -it app but not work as $ docker-compose up.

cloud_cloud
  • 1,921
  • 4
  • 16
  • 30
  • i think this wont work as you want. docker and docker-compose are diffrent programms for different use. just start your docker-compose file. or do you have a special need for only one container? – Gabbax0r Apr 28 '17 at 09:57
  • As explained [here](http://stackoverflow.com/questions/27664820/running-multiple-applications-in-one-docker-container) having multiple applications in one image is not the docker way of things. The overhead of having multiple containers is small. You can link them to each other and have them access one another without problems. – herm Apr 28 '17 at 11:18

1 Answers1

0

Docker compose is an orchestrator for MULTI container deployment. So won't be useful for creating a single image.

I would recommend keep the containers separate for production clusters but you can have multiple services with in a single container. Try supervisor or some other process manager, docker official documentation has all the details.

Let me know if it doesn't explain I will add an example here.

Qasim Sarfraz
  • 5,822
  • 2
  • 20
  • 26
  • 1
    Compose can work with a single container with no trouble at all. It is not orchestrating multiple containers then, but it is still very useful to define other things, such as network and volume configs, image name, env vars, and so on, in one well-defined file. – Dan Lowe Apr 28 '17 at 14:07
  • I totally agree with you but the said use case is about gluing two or more images into single image which won't be possible with compose. Having said that a layer of abstraction is always useful and with docker compose you certainly get better manageability. – Qasim Sarfraz Apr 30 '17 at 10:06