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

[BUG] docker-compose run still creates containers with an underscore in the name #10354

Closed
jamshid opened this issue Mar 8, 2023 · 0 comments · Fixed by #10357
Closed

[BUG] docker-compose run still creates containers with an underscore in the name #10354

jamshid opened this issue Mar 8, 2023 · 0 comments · Fixed by #10357
Assignees
Labels

Comments

@jamshid
Copy link

jamshid commented Mar 8, 2023

Description

docker compose run creates a container name with underscores instead of dashes

Steps To Reproduce

  1. Using this docker-compose.yml in a directory named detest:
services:
  foo:
    image: centos
  1. Running docker compose up -d correctly creates a container named dctest-foo-1.

  2. But docker compose run -d foo creates a container named dctest_foo_run_e556189032da.

I expected it to be named dctest-foo-run-e556189032da to avoid the problem where underscores are not a legal hostname.

Compose Version

Docker Compose version v2.15.1

Docker Environment

jafshar@JAFSHAR-MB1-17 dctest % docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.3)
  compose: Docker Compose (Docker Inc., v2.15.1)
  dev: Docker Dev Environments (Docker Inc., v0.1.0)
  extension: Manages Docker extensions (Docker Inc., v0.2.18)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.25.0)
  scout: Command line tool for Docker Scout (Docker Inc., v0.6.0)

Anything else?

This is a another inconsistency similar to the network and volume names in #9618 but it breaks the hostname so it's not just cosmetic.

*Well actually the network name with an underscore is bad too, that is part of the fully qualified hostname. But that can be worked around by specifying the network name in the compose yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants