'Docker run' doesn't pass environment variables
Hi ,
This is an issue for reopening #18701 (closed)
image: docker:latest
services:
- postgres:9.5
variables:
POSTGRES_DB: test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
stages:
- build
- release
- deploy
variables:
CONTAINER_TEST_IMAGE: registry.example.com/my-group/my-project:tag
CONTAINER_RELEASE_IMAGE: registry.example.com/my-group/my-project
before_script:
- env
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.example.com
build:
stage: build
script:
- docker build --pull -t $CONTAINER_TEST_IMAGE .
- docker run $CONTAINER_TEST_IMAGE ci/tests.sh
- docker push $CONTAINER_TEST_IMAGE
When I run the env command inside the container (through the ci/tests.sh script), env vars are not set. I need to specify each env variable using -e flag. Gitlab variables are not pass when using docker run
If you have more that 10 env variables , this can be painfull.
Also , this implies to manage env variable at different locations ( In gitlab secret variable , and in the gitlab-ci script )
That would be great to have a param or something to pass every env variable so this does not require to maintain it at different location.
Edited by Sébastien Tolron