Skip to content

Upgrading docker-compse 1.5.1 environment variable evaluated to None when using extends #2416

Closed

Description

@icollar

Since upgrading to Docker Compose v1.5.1 "secret" environment variables are sometimes being evaluated to None. Assuming that this is an issue with Compose as "None" is certainly from Python.

docker-compose.yml

app:
    image: alpine:edge
    entrypoint: ["/usr/bin/tail"]
    command: ["-f","/dev/null"]
    environment:
        - SECRET

ext:
    extends:
        service: app
    environment:
        - THING

When running:

$ export SECRET=secret
$ export THING=thing  
$ echo $SECRET 
secret
$ echo $THING
thing
$ docker-compose up -d
Creating test_app_1
Creating test_ext_1

$ docker exec test_app_1 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=056879fbe127
SECRET=secret
HOME=/root

$ docker exec test_ext_1 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=dece36c15a28
THING=None
SECRET=secret
HOME=/root

Currently I'm using a workaround with the variable substitution:

app:
    image: alpine:edge
    entrypoint: ["/usr/bin/tail"]
    command: ["-f","/dev/null"]
    environment:
        - SECRET=${SECRET}

ext:
    extends:
        service: app
    environment:
        - THING=${THING}

Docker and Docker Compose info below

$ docker info
Containers: 0
Images: 303
Server Version: 1.9.1-rc1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 307
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.19.0-30-generic
Operating System: Ubuntu 15.04
CPUs: 4
Total Memory: 7.529 GiB
Name: vcr005
ID: 2IDI:AT5B:LFKI:K3IQ:QYUH:NIEA:MKPM:TCT7:L7VQ:QNFM:O37Y:HF3J
WARNING: No swap limit support

$ docker-compose version
docker-compose version: 1.5.1
docker-py version: 1.5.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

Activity

  1. added this to the 1.5.2 milestone on Nov 18, 2015
  2. dnephin commented on Nov 18, 2015

    @dnephin

    I think this might be caused by the same thing as #2408, but I'll leave both open for now until I can confirm.

  3. icollar commented on Nov 18, 2015

    @icollar
    Author

    I thought so too, but I #2408 wasn't very clear as to exactly what the issue was. I suspect the underlying issue is related.

  4. self-assigned this
    on Nov 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions