Skip to content

Compose config with --no-interpolate fails as it tries to validate environment variables as ports #7964

@padraic-padraic

Description

@padraic-padraic

Description of the issue

When trying combine compose and override files with docker-compose config --no-interpolate, I get an validation error in the ports block for a service that uses environment variables.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.25.0, build unknown

Output of docker version

Docker version 19.03.8, build afacb8b7f0

Output of docker-compose config
(Make sure to add the relevant -f and other flags)
The issue relates to config!

Steps to reproduce the issue

  1. Small example file
     #compose.yml
     version: '3'
     services:
        test:
          image: hello-world
          ports:
              - "${DUMMY_PORT}:${DUMMY_PORT}"
  2. docker-compose -f compose.yml config --no-interpolate

Observed result

services.test.ports is invalid: Invalid port "${DUMMY_PORT}:${DUMMY_PORT}", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]

Expected result

version: '3'
services:
  test:
    image: hello-world
    ports:
      - "${DUMMY_PORT}:${DUMMY_PORT}"

Stacktrace / full error message

compose.config.config.find: Using configuration files: ./compose.yml
ERROR: compose.cli.main.main: The Compose file './compose.yml' is invalid because:
services.test.ports is invalid: Invalid port "${DUMMY_PORT}:${DUMMY_PORT}", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]

Additional information

OS version / distribution, docker-compose install method, etc.
Pop! OS 20.04, using system packages for docker / docker-compose.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions