rancher-compose --env-file not exporting variables to hosts

Created on 13 May 2016  路  1Comment  路  Source: rancher/rancher

Version:

RANCHER/SERVER: 1.1.0-dev1
DOCKER: 1.11.1
RACHER-COMPOSE: 0.8.0

AWS ubuntu 14.04 64bit hvm

Environment Type: (Cattle/Kubernetes/Swarm/Mesos)

Cattle

Steps to Reproduce:

Create a new stack from the rancher compose cli:
rancher-compose -p my-stack-name -e .env.staging up
rancher-compose -p my-stack-name --env-file .env.staging up
rancher-compose -p my-stack-name -e /full/path/to/.env.staging up
rancher-compose -p my-stack-name --env-file /full/path/to/.env.staging up

Results:

No environment variables are exported to the hosts

e.g.

image: mariadb
response: Cannot find MYSQL_DATABASE variable please set. (many other env variables errors)

Expected:

Environment variables set from command line argument -e path/to/.envfile or --env-file path/to/.env.file

All .env files have been chmod 777 having permissions -rwxrwxrwx. reside in same directory as rancher-compose.yml and docker-compose.yml.

There are no environment: keys or env_file keys within both rancher and docker compose files.

arerancher-compose kinbug

Most helpful comment

This feature is working properly, but I think it behaves differently than what you're expecting. You mention that there are no environment keys, but these are actually needed to specify which services should receive which environment variables.

For example, if you have an env file that contains ABC=ABC, only services that contain environment: [ABC] will actually have the variable set. Variables in env files don't automatically propagate to all services.

>All comments

This feature is working properly, but I think it behaves differently than what you're expecting. You mention that there are no environment keys, but these are actually needed to specify which services should receive which environment variables.

For example, if you have an env file that contains ABC=ABC, only services that contain environment: [ABC] will actually have the variable set. Variables in env files don't automatically propagate to all services.

Was this page helpful?
0 / 5 - 0 ratings