Jenkins build parameter not working in quotes

I’m trying to issue a jenkins shell command with docker looks like this:

docker run -v ${env.param1}:/workspace –privileged=true app sh -c ‘python app.py –option ${env.param1}’

  • Clear all entries in Docker mongodb?
  • How do I publish an ASP.NET Core application in a Docker container?
  • Running docker container at specific URL(s)
  • Django connection to postgres by docker-compose
  • How to convert docker-compose setup to docker image?
  • Citrus-Framework: How to wait for container to be healthy?
  • …and the result looks like this:

    docker run -v actual.param1:/workspace –privileged=true app sh -c ‘cd folder && python app.py –option ${env.param2}’

    The first environment parameter ${env.param1} is successfully replaced with actual parameter, but the second one ${env.param2} is not. Seems to me that because the second ${env.param2} is inside a single quote, jenkins is not replacing the parameter.

    Thank you for reading and I would appreciate your help!!

  • share images between host and child docker
  • Docker, install postgresql in a container contain “ubuntu:14.04”, lost when out of the container
  • Error while changing hostname inside docker container
  • docker login with non interactive session returns 401
  • Persist users across containers
  • Sporadic Robolectric test failures when running inside Docker container
  • One Solution collect form web for “Jenkins build parameter not working in quotes”

    docker run -v ${env.param1}:/workspace –privileged=true app sh -c ‘python app.py –option ${env.param1}’

    You are passing ${env.param1} inside of '‘s (single quotes), therefore it is not being evauluated, change your command to use doublequotes instead:

    docker run -v ${env.param1}:/workspace –privileged=true app sh -c “python app.py –option ${env.param1}”

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.