Skip to content

[BUG] -.json:10,5-19: Invalid name; only "[a-zA-Z0-9_-]+" are allowed #12919

Closed
@furai

Description

@furai

Description

It seems that recent change to docker compose and usage of bake by default to build images have introduced some incompatibility. Service names containing a dot character are valid according to the spec. Yet when building docker compose projects with service names with dots I'm getting:

-.json:10,5-19: Invalid name; only "[a-zA-Z0-9_-]+" are allowed

laravel/sail#786 - I've noticed it while using laravel sail which defines it's base service name as laravel.test.

When one does docker config > bake.yaml and then docker buildx bake -f bake.yaml everything builds as expected. Only running docker compose up and similar gives the error.

Steps To Reproduce

  1. Create compose.yml with contents like:
    services:
      this.is.a.test:
        build:
          context: .
          dockerfile: Dockerfile
    
  2. Create Dockerfile:
    FROM scratch
    
  3. Run docker compose up .
  4. Error happens here.

Compose Version

Docker Compose version 2.37.0

Docker Environment

Client:
 Version:    28.2.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.24.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.37.0
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 4
  Running: 0
  Paused: 0
  Stopped: 4
 Images: 81
 Server Version: 28.2.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: cb1076646aa3740577fafbf3d914198b7fe8e3f7.m
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.14.10-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 32
 Total Memory: 62.71GiB
 Name: archFuraiNix
 ID: GBA2:RCC2:I3KF:DCOL:KPFB:VESF:4CS7:AZJP:A6ZR:WOHV:GZ5X:4NS5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  dockerregistry.centerfield.com
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions