Skip to content

services.service.ports.published should be an integer when passed in via environment variable #5425

@n1ru4l

Description

@n1ru4l

When you set the port of a published port via an environment variable it is interpreted as a string.

Expected: The variable is interpreted as an integer.

# docker-compose build
ERROR: The Compose file './docker-stack.yml' is invalid because:
services.nginx.ports.published contains "8000", which is an invalid type, it should be an integer
# .env
PUBLIC_PORT=8080
DOCKER_REGISTRY=foobars
# docker-compose.yml
version: "3.2"

services:
  nginx:
    image: '${DOCKER_REGISTRY}/nginx-proxy'
    ports:
      - target: 80
        published: ${PUBLIC_PORT}
        protocol: tcp
        mode: host

Metadata

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