2

I have a container based on Ubuntu 16.04 and installed some custom stuff into /opt/bin.

Now I want to add /opt/bin to $PATH. However, no matter what I try, the path variable isn't available after the Docker container restarts.

So far I tried to add

export PATH=$PATH:/opt/bin

to /etc/profile and /etc/profile.d/myvars.sh.

What is the proper way to add the path?

Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67
benjist
  • 2,740
  • 3
  • 31
  • 58

1 Answers1

1

You may need to update .bashrc file in $HOME directory (~/.bashrc), not /etc/profile or /etc/profile.d/myvars.sh

export PATH: export PATH=$PATH:/opt/bin

To set it permanently, and system wide (all users, all processes) set variable in /etc/environment

PATH=$PATH:/opt/bin
f-society
  • 2,898
  • 27
  • 18