Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where should I put docker-compose.yml

When I pull the images from docker hub. Sometimes, I would like to run the images in a multi-container way. So I choose to use docker-compose. For example, I would run the zookeeper in replicated mode. I will new a file named docker-compose.yml, and run docker-compose up and wait for it to initialize completely.

My question is what is proper directory I should put docker-compose.yml file into?

like image 896
drlingyi Avatar asked Jun 27 '17 15:06

drlingyi


People also ask

Where do you put Docker compose yml?

The Compose file is a YAML file defining services, networks and volumes. The default path for a Compose file is ./docker-compose.yml .

Where should I put docker config?

In Windows containers, configs are all mounted into C:\ProgramData\Docker\configs and symbolic links are created to the desired location, which defaults to C:\<config-name> . You can set the ownership ( uid and gid ) for the config, using either the numerical ID or the name of the user or group.

Do you need a docker compose yml file?

Docker-Compose: Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services (containers). Then, with a single command, you create and start all the services from your configuration.


1 Answers

I'm asking myself the same question: Where to put my docker-compose.yml file?

I've decided to do it the following way:

  • One Repo for the docker-compose.yml along with deployment scripts (Jenkins pipeline in my case).
  • One Repo per micro service along with a Dockerfile and its build logic (built image is pushed to private docker registry).

Why?

  • The docker-compose.yml describes a system (the composition of micro services) and how it is deployed.
  • A micro services should be independent from the system infrastructure.
  • There could be more than one system (different composition of the micro services) with a second docker-compose.yml (and Repo).

However, of course there are reasonable exceptions. Assume you're deploying a customized Database along with a management tool (e.g. customized mariadb and adminer), then most things may live in one repository.

like image 171
rrhrg Avatar answered Sep 20 '22 18:09

rrhrg