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.

  • Docker clone private repo - Permission denied
  • Connectionstring from docker container to SQL Server dblocal in host
  • installing cPickle with python 3.5
  • Basic auth for Curl command into the secret of openshift
  • Docker and file sharing on OS X
  • How to deploy a echo app to Marathon (on Mesos on Docker on Mac)?
  • 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
    services:
      - docker
    before_install:
      - env | grep -vE "^(PATH=)" > .env
    install:
      - docker build -t mycompany/myapp .
    script:
      - docker run -i --env-file .env mycompany/myapp nosetests
    after_success:
      - echo "SUCCESS!"
    

  • run /usr/sbin/sshd in a Dockerfile does not work
  • Logstash crashes as soon as it starts
  • run docker exec from swarm manager
  • Want to use volumes in my running Docker container
  • Jenkins Docker Pipeline Exit Code -1
  • Ambiguous port publish parameters to “docker run”
  • 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.