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

Compose v3.9 name attribute fails validation ('name' does not match any of the regexes) #9412

Closed
quaos opened this issue Apr 22, 2022 · 4 comments
Labels

Comments

@quaos
Copy link

quaos commented Apr 22, 2022

Description

Hi. I've been using Compose for a while. Recently I started adding name attribute to the files to specify container group/project name.
But recently, I get this error when building. (See: Describe the results you received section)

If I comment out the name attribute, compose can build with the file normally.

Ref. Issue: #745

I've searched in the issues and did not find any mention of this attribute being deprecated.

(For now I'd use COMPOSE_PROJECT_NAME env variable as a workaround.)

Steps to reproduce the issue:

  1. Create new docker-compose.yaml with minimal services section.
  2. Add name: 'my-project' to root of file.
  3. Run docker-compose build or docker-compose -f docker-compose.yml config.

Describe the results you received:

with name attribute:

# docker-compose -f docker-compose.yml config

ERROR: The Compose file './docker-compose.yml' is invalid because:
'name' does not match any of the regexes: '^x-'

when commenting out name attribute:

# docker-compose -f docker-compose.yml config

networks:
#  ...
services:
#  ...
version: '3.9'
volumes:
#  ...

(I've commented out version attribute in my compose file)

Describe the results you expected:

It should build the images. And when using docker-compose up the container group should have specified name.

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

Output of docker compose version:

# docker compose version
Docker Compose version v2.3.3

# docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.1)
  compose: Docker Compose (Docker Inc., v2.3.3)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 9
  Running: 3
  Paused: 0
  Stopped: 6
 Images: 73
 Server Version: 20.10.13
 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.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.774GiB
 Name: docker-desktop
 ID: OOPR:JCU6:V56R:LGBB:WXH7:RIJC:YGJC:GSF3:KYFR:L5ZH:E3XX:ULSA
 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

Additional environment details:

OS: Mac OS v10.14.6 (Mojave)

@MartynasAndr
Copy link

MartynasAndr commented Apr 22, 2022

Same problem after upgrading to docker 20.10.13, before it was working without problems.
EDIT:
Enabling "Use Docker Compose V2" in Docker Desktop fixed the problem

@ndeloof
Copy link
Contributor

ndeloof commented Apr 24, 2022

docker-compose version 1.29 does not support this new attribute introduced by the compose specification, this only can be used with compose v2
@glours @ulyssessouza maybe we should add support for this (at least, ignore it) in python codebase to avoid such compatibility issue?

@stale
Copy link

stale bot commented Oct 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 30, 2022
@stale
Copy link

stale bot commented Nov 12, 2022

This issue has been automatically closed because it had not recent activity during the stale period.

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

No branches or pull requests

3 participants