Docker Ubuntu PATH won't save
NickName:DJFast Ask DateTime:2021-01-12T03:53:29

Docker Ubuntu PATH won't save

I am using a Ubuntu image (Ubuntu 20.04). Essentially, I am trying to modify my PATH permanently so that every time I start the container I don't have to manually edit the PATH to find the new items I have installed. However, no matter what I do I am unable to make the change permanent. I have sunk some considerable time into the image, so I would very much like to find a solution so I don't have to rebuild the whole thing.

Here is the shell information

#ps -p $$
  PID TTY          TIME CMD
    9 pts/1    00:00:00 sh 

# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# PATH=$PATH:/kraken
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/kraken

#. ~/.profile

Now when I restart the container:

#echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Basically, the PATH was not saved. I have been through so many blogs and stack and I can't find anything that sticks. Any help would be really appreciated.

Copyright Notice:Content Author:「DJFast」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65673632/docker-ubuntu-path-wont-save

More about “Docker Ubuntu PATH won't save” related questions

Build docker ubuntu image by Dockerfile

If command "docker run ubuntu bash" the container won't last. but if I command "docker run -it ubuntu bash" the container will make a pseudo-tty and keep this container alive. my question is is ...

Show Detail

DOCKER_TLS_VERIFY, DOCKER_HOST, and DOCKER_CERT_PATH on Ubuntu

If DOCKER_TLS_VERIFY, DOCKER_HOST and DOCKER_CERT_PATH are not set on Ubuntu, what are the defaults to export the vars by myself (I'm not using Docker Machine)? ps aux | grep "docker daemon" retu...

Show Detail

Running Docker on Ubuntu docker image

I'm having trouble getting Docker CE to run on an Ubuntu Docker image. Here's my Dockerfile: FROM ubuntu:16.04 RUN apt-get update && apt-get install -y curl apt-transport-https ca-certifi...

Show Detail

Docker running ubuntu with elasticsearch

I have a ubuntu docker. I install elasticsearch service it. When i use the command "curl -X GET 'localhost:9200' ", it return me the version, the name, all right. It means the elasticsearch is

Show Detail

Docker installed with snap in Ubuntu 19.04 won't stay started

I installed docker via snap in Ubuntu. It worked fine until I rebooted. Since reboot, it won't stay started. So we start the daemon manually: $ sudo snap start docker Started. Cool. Looks sta...

Show Detail

Docker ubuntu - elasticsearch

I create a container with ubuntu's image. That's all right, and i can use very well. So, i install a elasticsearch service in this ubuntu's docker. I have a ubuntu docker. I install elasticsearch

Show Detail

Adding the most recent stable Docker repository path in Ubuntu Bionic Beaver

After following steps 1 - 3 from the official docker engine install steps for Ubuntu (updating apt packages, adding Docker’s official GPG key, and applying the command to set up the repository) I g...

Show Detail

Docker on Ubuntu

I try to install docker on my Ubuntu 16.04.4 LTS. I know how to use basic things on linux but not much in details. Thats why i followed following tutorial: https://docs.docker.com/install/linux/do...

Show Detail

Docker Ubuntu image missing prompt, color and completion?

If I create a new Docker image based from ubuntu:14.04 image and run it with: docker run -i --name="TEST" ubuntu:14.04 /bin/bash then I will have a minimalistic Ubuntu with Bash running, but I wo...

Show Detail

Change default installation path docker ubuntu

I have an Ubuntu Azure VM whith a data disk mount in the /datadrive. As the documentation of Azure said, I must to install applications in that directory. Now, I want to install docker with apt-get

Show Detail