8

So I have written a dockerfile and when I run the image the PATH is

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

I want to add another entry to the PATH so in my dockerfile I tried

ENV PATH="${PATH}:/some/new/path"

However when I tried that the PATH changed to include my personal path (with /some/new/path appended). How do I arrange it so that /some/new/path is appended without changing the rest of the PATH to my personal PATH?

The docker image is being run with --entrypoint /bin/bash and argument --norc which I'd prefer not to change if possible.

I'm using Ubuntu 14.04.

john
  • 85,011
  • 4
  • 57
  • 81
  • Can you add the complete Dockerfile to the question? Can you just install your software into one of the directories that's already on `$PATH` (it's isolated inside your image)? – David Maze Mar 29 '19 at 13:38
  • I can't post the dockerfile as it's proprietory. It's mostly package installation with apt-get and some downloading and unzipping. I don't think there's anything unusual. It's not possible to install this particular piece of software somewhere other than where it wants to go, so that's not an option. – john Mar 29 '19 at 13:41

1 Answers1

11

To append the containers $PATH try something along these lines in the Dockerfile:

ENV PATH /usr/local/postgres-$PG_MAJOR/bin:$PATH

Resources:

David J Eddy
  • 1,999
  • 1
  • 19
  • 37
  • 1
    As I said in my question, I tried that but it wasn't what I wanted as my own path gets put into the image. – john Mar 29 '19 at 23:27
  • Oh, that's no good. The way I read the docs it would append the value you specify to $PATH. Sorry about that. – David J Eddy Mar 31 '19 at 01:13