How to use env var in WORKDIR stanza?

I have a pretty slim Dockerfile so far:

FROM ubuntu:trusty

ADD mypackage-${MYPACKAGE_VERSION}.tar.gz /root/

The .tar.gz gets properly added to the docker file, (it is automatically extracted which is frustrating as that may not be desirable at all times). so on the image the path /root/mypackage-0.1.2/ exists and contains the content I want to work with, however the WORKDIR stanza cd’s into the literal path /root/mypackage-${MYPACKAGE_VERSION}, escaped as /root/fifechan-\$\{FIFECHAN_VERSION\}/.

  • For multiple projects using Docker, use Multiple VMs or Single Host with multiple containters
  • List files in exited container
  • Deploying .NET Core 1.1 App to Docker - Could not resolve CoreCLR path
  • Can not login docker via ssh
  • How do pass in DOCKER_OPTS into docker image running from Docker for Mac?
  • Can docker-compose directly reference other docker-compose files and start everything in them?
  • I find the inconsistent variable handling very frustrating; How am I supposed to specify this directory for use?

  • How stop service jira in docker for updating jira?
  • Docker Copy and change owner
  • docker --storage-opt dm.basesize=40G does not work?
  • How to do dynamic port mapping in docker and proxy?
  • Installed docker and ran a container with mongodb, now brew's mongodb isn't working
  • How to run docker container with -i -t options using TeamCity?
  • One Solution collect form web for “How to use env var in WORKDIR stanza?”

    See Github issue here: The issue suggests this has now been fixed. Are you using the latest version?

    You can also override the WORKDIR in the Dockerfile when calling docker run:

    docker run -w=/root/mypackage-0.13
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.