Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

423
Vistas
How do I run the same docker-compose.yml several times on same docker daemon with different names?

My situation. Trying to run a docker-compose structure several times on the same box. This is my docker-compose.yml:

version: '3'
services:
  code:
    image: organization:java-maven
    links:
      - mysql:mysql
    volumes:
      - "${PWD}:/home/ubuntu/src"
  mysql:
    image: organization:mysql

Running this twice with docker-compose run code mvn clean test creates two containers of code and one container of mysql.

Now, I want one code to be linked to one mysql, and another code linked to another mysql.

How do I accomplish this? This is supposed to run on jenkins slaves and the maven executions cannot share mysql.

I've miserably failed trying with the "-e KEY=VALUE" option for docker-compose run together with container_namein the docker compose file.

Not sure how to approach this, please help, thank you.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

So, I focused too much on using directives to alter container names manually. The solution was much easier.

docker-compose -p anything run code mvn clean test

docker-compose -p anything_else run code mvn clean test

So, this is the project name solution. Docker compose will use the value given with the option -p as a prefix when creating container names. That means no collision.

Very handy!

For more reading: documentation around project-name option

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda