How to get all Travis CI environment variables, excluding the default system ones?

I want to pass into docker run all the environment variables I’ve configured in the Travis web UI.

I’m able to run env > .env to save them to a file and then pass that into docker via --env-file .env.

  • SSH to docker bridged instance
  • Docker-Compose - Server exposes several ports but only one of the ports is not accessible in the client
  • how can I support http_proxy or logic control in Dockerfile during docker build?
  • Docker not working in Windows10
  • 12factor config approach with Docker
  • Squishing docker image without spinning a container
  • Unfortunately, this also overrides system ones such as PATH that interfere with the container.

    I’m able to filter out PATH using env | grep -vE "^(PATH=)" > .env but I’m wondering whether there’s a way to get just the Travis ones?

    Here’s my .travis.yml:

    language: bash
    sudo: required
      - docker
      - env | grep -vE "^(PATH=)" > .env
      - docker build -t mycompany/myapp .
      - docker run -i --env-file .env mycompany/myapp nosetests
      - echo "SUCCESS!"

  • Using iPython with remote docker container in a local project directory
  • Chown mounted volume in boot2docker osx
  • Does docker --rm=true affect caching adversly?
  • Copying a directory into a docker image while skipping given sub directories
  • how can i dynamically create a docker container from a node application
  • Setting the hostname for a container running in Kubernetes
  • One Solution collect form web for “How to get all Travis CI environment variables, excluding the default system ones?”

    I don’t recommend passing all your environment vars, but if you whitelist them by prefixing them with something like, say, TRAVIS_ you could do something like:

    export TRAVIS_WUT=foo
    export TRAVIS_FOO=asdf
    docker run $(printenv | grep -E '^TRAVIS_' | sed 's/TRAVIS_/-e /g')
      # would run -> docker run -e FOO=asdf -e WUT=foo something
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.