Skip to content

using invalid format for service secrets misbehaves instead of failing #1365

@SinnySupernova

Description

@SinnySupernova

Describe the bug
using invalid format for service secrets doesn't fail, but misbehaves instead

Steps to reproduce the behavior

  1. create a secret echo "aaa" | podman secret create test-secret -
  2. create docker-compose.yml
services:
  tester:
    image: debian:trixie-slim
    command: "tail -f /dev/null"
    container_name: tester
    init: true
    secrets:
      test-secret: # this is not valid according to [docker compose spec](https://docs.docker.com/reference/compose-file/services/#secrets)
        source: test-secret
        type: env
        target: MY_VAR

secrets:
  test-secret:
    external: true
  1. run docker compose up -d

Expected behavior
the command fails because services.tester.secrets in the docker compose file is invalid

Actual behavior
command runs, and the secret test-secret is mounted to /run/secrets/test-secret, but not as env variable

Output

$ podman-compose version
podman-compose version 1.5.0
podman version 5.7.0

Additional context

Reason for this is likely that dicts in python are enumerable and this line here
enumerates keys of secrets dict, which is incorrect behaviour here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions