Skip to content

docker-compose container name separator switches between - and _. #24

Closed

Description

@m000
  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: B6CD6541-132F-4401-A847-57D0C1C6D921/20211209193540

Actual behavior

docker-compose switches between - and _ as a container name separator between releases.

Expected behavior

docker-compose must consistently use - as a container name separator.

Information

  • Running with Docker Desktop 4.3.0 (71786) on Windows 11, with the WSL2 backend.
  • Docker Compose V2 is checked in the settings. docker-compose version is v2.2.1.
  • This seems to have appeared with the 4.3.0 update. It is not noticed unless you rebuild your environment. I.e. existing environments continue to use - as the container name separator.
  • I had the same issue a couple of months back. That time, it was also fixed with an update.

Steps to reproduce the behavior

  • Sample docker-compose file:
    version: '3.4'
    
    services:
      db:
        image: postgres:latest
        restart: always
        ports:
          - "127.0.0.1:1020:5432"
        volumes:
          - postgres:/var/lib/postgresql/data
        env_file:
          - .env
        environment:
          - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      postgres:
  • Steps:
    docker-compose -f docker-compose-test.yaml -p separator-test up
    # creates separator-test_db_1
    docker-compose -f docker-compose-test.yaml -p separator-test down
    sudo wget -q https://github.com/docker/compose/releases/download/v2.2.1/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose-v2.2.1-gh
    sudo ln -sf /usr/local/bin/docker-compose-v2.2.1-gh /usr/bin/docker-compose
    docker-compose -f docker-compose-test.yaml -p separator-test up
    # creates separator-test-db-1
    docker-compose -f docker-compose-test.yaml -p separator-test down
    sudo ln -sf /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-compose /usr/bin/docker-compose /usr/bin/docker-compose

Activity

  1. changed the title [-]Container name separator switches between `-` and `_`.[/-] [+]docker-compose container name separator switches between `-` and `_`.[/+] on Dec 9, 2021
  2. transferred this issue fromdocker/for-winon Dec 10, 2021
  3. m000 commented on Dec 10, 2021

    @m000
    Author

    @lorenrh Are you sure about transferring the issue? This looks like a packaging issue of docker desktop for windows. Standalone docker-compose releases from the compose repo seem to work fine.

  4. lorenrh commented on Dec 13, 2021

    @lorenrh
    Member

    Thanks for the pointer, actually this is an issue relate to the compose-switch used on mac and on Windows. I'll transfer the issue over there.

    We've also created an internal ticket to tackle this soon.

  5. transferred this issue fromdocker/composeon Dec 13, 2021
  6. mat007 commented on Dec 13, 2021

    @mat007
    Member

    This is due to #21

  7. mat007 commented on Jan 14, 2022

    @mat007
    Member

    The fix has now been released with Docker Desktop 4.4.2, in case you’re using Desktop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions