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 automatic container naming on Sox and Linux ('_' vs. '-') #6035

Closed
1 of 3 tasks
atomcat1978 opened this issue Nov 8, 2021 · 6 comments
Closed
1 of 3 tasks

Comments

@atomcat1978
Copy link

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

docker-compose up should use same automatic naming conventions for service containers under Docker Desktop for Mac and on Linux docker versions.

Actual behavior

On Linux Docker uses underscores (_), while on Docker Desktop for Mac dash (-) is used.

Information

  • macOS Version: macOS 12.0.1 (21A559)
  • Intel chip or Apple chip: Intel chipset, 2,4 GHz 8-Core Intel Core i9
  • Docker Desktop Version: Docker Desktop 4.1.1 (69879)

Steps to reproduce the behavior

  1. Run docker-compose up on linux.
  2. Run docker-compose up on Mac + Docker Desktop.
  3. Check the created container names (projectName-serviceName-1 (OSx) vs. projectName_serviceName_1 (linux))
@olegrusu
Copy link

olegrusu commented Nov 8, 2021

We are having the same issue with our container names. Out of the blue, the container names changed from web_name_1 to web-name-1 after a rebuild and it broke a couple of scripts that actually rely on these old names.

Are there any other solutions except for adding container_name to the docker-compose configuration? I know that once the container_name is added the containers itself cannot be scaled.

@ryan-benedetti
Copy link

ryan-benedetti commented Nov 9, 2021

I solved this issue on my local environment by turning off "Use Docker Compose v2" under Preferences > General. Not a long-term fix, but gets you by for the interim.

@atomcat1978
Copy link
Author

@ryan-benedetti Seems like it is turned off on in my environment, still get dashes in the names.

@thaJeztah
Copy link
Member

Looks related to docker/compose#8655. From that PR, it's possible to use the old names by using the --compatiblity flag

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Apr 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants