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

docker stack config does not resolve values from .env #46295

Closed
membersound opened this issue Aug 22, 2023 · 1 comment
Closed

docker stack config does not resolve values from .env #46295

membersound opened this issue Aug 22, 2023 · 1 comment

Comments

@membersound
Copy link

membersound commented Aug 22, 2023

Description

I'm trying to set some variables like the image name from .env, to run it in docker swarm as follows:

docker stack deploy -c <(docker stack config -c docker-compose.yml) my-app

Problem: docker stack config loses tags that use values from .env file, see steps to reproduce.

Reproduce

cat docker-compose.yml:

services:
  app:
    image: $APPLICATION_IMAGE
      #env_file: '.env'
    ports:
      - 8090:8080

.env:
APPLICATION_IMAGE=my.docker.repo/my-app:latest

docker stack config -c docker-compose.yml:

services:
  app:
    ports:
    - mode: ingress
      target: 8080
      published: 8090
      protocol: tcp

Expected behavior

image tag should be present and filled with value from .env:

services:
  app:
    image: my.docker.repo/my-app:latest
    ports:
    - mode: ingress
      target: 8080
      published: 8090
      protocol: tcp

docker version

Client: Docker Engine - Community
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:35:23 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:23 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 34
  Running: 11
  Paused: 0
  Stopped: 23
 Images: 479
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  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: active
  NodeID: m98663673nkszvyj3f2fnctvd
  Is Manager: true
  ClusterID: 4tigljlfpmc4aqt5yb2nrz7x6
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 192.168.134.214
  Manager Addresses:
   192.168.134.214:2377
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-73-generic
 Operating System: Ubuntu 22.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 11.66GiB
 Name: svdev4
 ID: DKLD:FBO7:72JP:LPYR:JKGE:GKJR:CQEA:AWEC:HGNC:DFCZ:HDES:LN4H
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 11.0.0.0/16, Size: 24

Additional Info

No response

@membersound membersound added kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. status/0-triage labels Aug 22, 2023
@thaJeztah thaJeztah added area/swarm area/stack kind/duplicate and removed kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. labels Aug 22, 2023
@thaJeztah
Copy link
Member

This looks like a duplicate of #29133

closing this one, so that the conversation doesn't diverge.

@thaJeztah thaJeztah closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants