Skip to content

[BUG] docker compose config overrides additional bind options with empty dict {} #13500

@mlalpho

Description

@mlalpho

Description

Since updating to Compose v5.0.0, we are seeing an issue with output from docker compose config regarding the long syntax of bind volumes.

Previously, docker compose config would convert the short syntax to the long syntax and include:

bind:
  create_host_path: true

Now, the output includes:

bind: {}

Because of this change, our CI jobs are failing with:

Error response from daemon: invalid mount config for type "bind": bind source path does not exist

We tried to work around by specifying the long syntax with :

    - type: bind
        source: ...
        target: ...
        bind:
          create_host_path: true

But, when it's run thru docker compose config it goes back to bind: {}

We're trying to avoid updating all our scripts to create these folders as-needed.

Any help would be greatly appreciated!

Steps To Reproduce

Long syntax:

docker-compose.yml

services:
  application:
    image: bash
    volumes:
      - type: bind
        source: ./non-existent-folder
        target: /datadir
        bind:
          create_host_path: true

Output from docker compose -f docker-compose.yml config where cwd=/root:

name: root
services:
  application:
    image: bash
    networks:
      default: null
    volumes:
      - type: bind
        source: /root/non-existent-folder
        target: /datadir
        bind: {}
networks:
  default:
    name: root_default

Short syntax:

docker-compose.yml:

services:
  application:
    image: bash
    volumes:
      - ./non-existent-folder:/datadir

Output from docker compose -f docker-compose.yml config where cwd=/root:

name: root
services:
  application:
    image: bash
    networks:
      default: null
    volumes:
      - type: bind
        source: /root/non-existent-folder
        target: /datadir
        bind: {}
networks:
  default:
    name: root_default

Compose Version

Docker Compose version v5.0.0

Docker Environment

Client: Docker Engine - Community
 Version:    29.1.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.30.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.0.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 203
 Server Version: 29.1.2
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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: 1c4457e00facac03ce1d75f7b6777a7a851e5c41
 runc version: v1.3.4-0-gd6d73eb8
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 4.18.0-553.89.1.el8_10.x86_64
 Operating System: Oracle Linux Server 8.10
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.61GiB
 Name: [redacted]
 ID: ENKJ:ZFL7:B6EO:EE6Q:NAX3:Y7PM:S6IF:JP6V:LXGG:AC7J:KAEQ:YYXV
 Docker Root Dir: /UserData/AppData/opt/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables

WARNING: Support for cgroup v1 is deprecated and planned to be removed by no lat                                                                             er than May 2029 (https://github.com/moby/moby/issues/51111)

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