I
I
Igor2021-08-19 18:53:44
Docker
Igor, 2021-08-19 18:53:44

Docker-compose container name conflict?

Colleagues, welcome.
I'm confused, I remember it worked before.

docker-compose-ci.yml

services:

  app:
    container_name: rmok-ci.app
    image: rmok-ci/app:latest
    restart: always
    build:
      context: .
      dockerfile: ./docker/php/Dockerfile
    volumes:
      - symfony_var_cache_audio:/www/var/cache/app/audio
    networks:
      - symfony
    expose:
      - 9000
    environment:
      PHP_INI_SCAN_DIR: ":/usr/local/etc/php/custom.d"
      TZ: "Europe/Moscow"


docker-compose.yml
services:

  app:
    container_name: rmok.app
    image: rmok/app:latest
    restart: always
    build:
      context: .
      dockerfile: ./docker/php/Dockerfile
    volumes:
      - symfony_var_cache_audio:/www/var/cache/app/audio
    networks:
      - symfony
    expose:
      - 9000
    environment:
      PHP_INI_SCAN_DIR: ":/usr/local/etc/php/custom.d"
      TZ: "Europe/Moscow"


When executed, they overwrite each other.
docker-compose up -d --build --remove-orphans
docker-compose -f docker-compose-ci.yml -d --build --remove-orphans


I expect to have two containers running with different names.

Notice the container_namecontainer name is different.

Where am I wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2021-08-19
@IgorPI

I think there is a solution, the point is that docker-compose is guided by the name of the folder in which the assembly is performed.
If you change the name of the project folder, name it differently, the problem is not observed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question