Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 tasks done
m000 opened this issue Dec 9, 2021 · 4 comments · Fixed by #25
Closed
3 tasks done

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

m000 opened this issue Dec 9, 2021 · 4 comments · Fixed by #25

Comments

@m000
Copy link

m000 commented Dec 9, 2021

  • 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
@m000 m000 changed the title Container name separator switches between - and _. docker-compose container name separator switches between - and _. Dec 9, 2021
@lorenrh lorenrh transferred this issue from docker/for-win Dec 10, 2021
@m000
Copy link
Author

m000 commented Dec 10, 2021

@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.

@lorenrh
Copy link
Member

lorenrh commented Dec 13, 2021

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.

@lorenrh lorenrh transferred this issue from docker/compose Dec 13, 2021
@mat007
Copy link
Member

mat007 commented Dec 13, 2021

This is due to #21

@mat007
Copy link
Member

mat007 commented Jan 14, 2022

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants