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 config outputs name parameter, stack fails with 'Additional property name is now allowed' #9424

Closed
carlhodder opened this issue Apr 28, 2022 · 1 comment

Comments

@carlhodder
Copy link

carlhodder commented Apr 28, 2022

Basically compose and stack are not working together in latest version:

docker compose -f docker-compose-database.yml config > result.yml adds:
"name: {folder}"

docker stack -c result.yml {service} errors with 'Additional property name is not allowed'

compose yml example:

version: '3.9'
services:
    postgres:
        container_name: backend_postgres
        image: postgres:13-buster
        restart: always
        tmpfs:
            - /dev/shm:size=${DOCKER_SHM_SIZE_BYTES:-512000000}
        env_file:
            - .env
        ports: 
            - "5432:5432"
        volumes:
            - /mnt/data/db/13/data/:/var/lib/postgresql/data/
        command: >
            postgres
            -c shared_buffers=${POSTGRES_SHARED_BUFFERS:-512MB}
            -c work_mem=${POSTGRES_WORK_MEM:-32MB}
            -c maintenance_work_mem=${POSTGRES_WORK_MEM:-256MB}
        networks:
            - database_network
        healthcheck:
          test: ["CMD", "/bin/bash", "-c", "pg_isready"]
        deploy:
          mode: replicated
          replicas: 1
          update_config:
            order: stop-first
            parallelism: 1
            failure_action: rollback
            monitor: 30s
          restart_policy:
            condition: any
            delay: 5s
            window: 90s

networks:
    database_network:
        name: database_network
        driver: overlay

docker compose config outputs (secrets stripped, and we prepend "version: '3.9'" to output before consuming):

version: '3.9'
name: backend
services:
  postgres:
    command:
    - postgres
    - -c
    - shared_buffers=512MB
    - -c
    - work_mem=32MB
    - -c
    - maintenance_work_mem=256MB
    container_name: backend_postgres
    deploy:
      mode: replicated
      replicas: 1
      update_config:
        parallelism: 1
        failure_action: rollback
        monitor: 30s
        order: stop-first
      restart_policy:
        condition: any
        delay: 5s
        window: 1m30s
    environment:
      (OMMITTED)
    healthcheck:
      test:
      - CMD
      - /bin/bash
      - -c
      - pg_isready
    image: postgres:13-buster
    networks:
      database_network: null
    ports:
    - mode: ingress
      target: 5432
      published: 5432
      protocol: tcp
    restart: always
    tmpfs:
    - /dev/shm:size=512000000
    volumes:
    - type: bind
      source: /mnt/data/db/13/data/
      target: /var/lib/postgresql/data
      bind:
        create_host_path: true
networks:
  database_network:
    name: database_network
    driver: overlay

Expected behaviour: either don't create and add this field to output, or docker stack should accept/ignore it.

Version:
Docker: 20.10.14, build a224086

Docker info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.8.2)
compose: Docker Compose (Docker Inc., v2.4.1)
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: 4
Running: 4
Paused: 0
Stopped: 0
Images: 94
Server Version: 20.10.14
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: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: active
NodeID: 44pjigzt9pxjithhv3jmtn2cl
Is Manager: true
ClusterID: 2z407xi24syndhj1snfsm7mt7
Managers: 1
Nodes: 1
Default Address Pool: 10.0.0.0/8
SubnetSize: 24
Data Path Port: 4789
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 10
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.65.3
Manager Addresses:
192.168.65.3:2377
Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
Default Runtime: runc
Init Binary: docker-init
containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
runc version: v1.0.3-0-gf46b6ba
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.102.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 24.98GiB
Name: docker-desktop
ID: OCXV:42LW:KJJZ:EQH5:XQQV:DEXW:MVL3:5FEB:IXTV:JPPD:UEPM:55PV
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

@ndeloof
Copy link
Contributor

ndeloof commented Apr 29, 2022

same answer I gave you on #9425
I'm closing this as a duplicate, feel free to comment on #9425

@ndeloof ndeloof closed this as completed Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants