john
john

Reputation: 87959

How to append to path in dockerfile or docker run

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.

Upvotes: 12

Views: 11192

Answers (1)

David J Eddy
David J Eddy

Reputation: 2037

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

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

Resources:

Upvotes: 13

Related Questions