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

Parameter expansion resolves invalid default value #9349

Closed
remi00 opened this issue Apr 4, 2022 · 1 comment
Closed

Parameter expansion resolves invalid default value #9349

remi00 opened this issue Apr 4, 2022 · 1 comment

Comments

@remi00
Copy link

remi00 commented Apr 4, 2022

Description

There is a problem resolving the environment variables when using env_file parameter. The resolution works great with environment parameter. Shell resolution on the host also works just fine. Feature works in docker compose v1.x.

I guess this relates with compose-go support, but from end-user point of view, docker compose official docs state that this feature should basically work.

Steps to reproduce the issue:

  1. Setup basic configuration like this:
# docker-compose.yml:
version: "3.9"
services:
  foobar:
    image: any.foo/bar
    env_file: ./some.env
    entrypoint: /usr/bin/foo/bar
    environment:
      - FROM_YAML=${FROM_YAML:-it-works-great}

and:

# some.env:
FROMENVFILE=${FROMENVFILE:-it-does-not-work-well}
  1. Run docker compose config

Describe the results you received:

name: foobar
services:
  foobar:
    entrypoint:
    - /usr/bin/foo/bar
    environment:
      FROM_YAML: it-works-great
      FROMENVFILE: :-it-does-not-work-well}
    image: any.foo/bar
    networks:
      default: null
networks:
  default:
    name: foobar_default

Describe the results you expected:

name: foobar
services:
  foobar:
    entrypoint:
    - /usr/bin/foo/bar
    environment:
      FROM_YAML: it-works-great
      FROMENVFILE: : it-does-not-work-well
    image: any.foo/bar
    networks:
      default: null
networks:
  default:
    name: foobar_default

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.3.3
(also v2.4.1)

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.7.1-docker)
  compose: Docker Compose (Docker Inc., 2.3.3)

Server:
 Containers: 9
  Running: 1
  Paused: 0
  Stopped: 8
 Images: 6
 Server Version: 20.10.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10f428dac7cec44c864e1b830a4623af27a9fc70.m
 runc version: v1.1.0-0-g067aaf85
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.105-1-MANJARO
 Operating System: Manjaro Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 24
 Total Memory: 62.81GiB
 Name: <redacted>
 ID: <redacted>
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: remi00
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
@remi00
Copy link
Author

remi00 commented Apr 4, 2022

Duplicate of #9303

@remi00 remi00 closed this as completed Apr 4, 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

1 participant