Skip to content

Compose using underscore when generating volume and network names #9618

@knovoselic

Description

@knovoselic

Description
The new docker compose plugin is using underscores instead of dashes when generating volume and network names. This makes it so that half resources contain dashes in the names, and other half contain underscores.

Steps to reproduce the issue:
Use the following docker-compose.yml

version: '3.8'
services:
  web-app:
    image: ruby
    volumes:
      - .:/app:cached
      - cool-volume:/usr/local/bundle
    networks:
      - custom-network

networks:
  custom-network:

volumes:
  cool-volume:

Run docker compose -p my-test up.

Describe the results you received:
Created volume and network resources have underscore in their name:

 ⠿ Network my-test_custom-network  Created
 ⠿ Volume "my-test_cool-volume"    Created
 ⠿ Container my-test-web-app-1     Created

Describe the results you expected:
I'd expect the expected names to contain only dashes, same as container name:

my-test-custom-network
my-test-cool-volume

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.6.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.6.0)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 11
  Running: 1
  Paused: 0
  Stopped: 10
 Images: 21
 Server Version: 20.10.16
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.1-0-g52de29d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 24.42GiB
 Name: docker-desktop
 ID: 6WFW:Y2JC:QG4N:3ENS:CGNS:WLHG:TM3T:J2LC:FSR2:WO56:3YFI:UWYJ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Is this a bug or intended behavior?

Metadata

Metadata

Assignees

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