Skip to content

Kompose not handling docker-compose file generated using docker config command #1364

Closed
@elishkaflint

Description

Kompose cannot handle converting a docker-compose file, when variable placeholders have been replaced with values from a .env file (using the docker-compose config command). This is quite a common use-case, which I saw working with the same steps a couple of months ago, but it now fails with the error FATA services.rabbit-mq.ports.0 must be a string or number

original docker-compose.yml with variable placeholders:

rabbit-mq:
    image: rabbitmq:3-management
    hostname: my-rabbit
    ports:
    - "${RABBITMQ_PORT}:${RABBITMQ_PORT}"
    - "15672:15672"

.env file

RABBITMQ_PORT=5672

docker-compose-resolved.yml (output of running docker-compose config > docker-compose-resolved.yml)

  rabbit-mq:
    hostname: my-rabbit
    image: rabbitmq:3-management
    ports:
    - published: 5672
      target: 5672
    - published: 15672
      target: 15672

^^^ note the published and target fields in the ports section

when i run kompose convert -f docker-compose-resolved.yml I get this error:
FATA services.rabbit-mq.ports.0 must be a string or number

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions