0

I installed pyenv in docker, but when I exit, again

 docker run -it image

will be

bash: pyenv: command not found

I can only retype the following command:

The export PATH = "/ root/pyenv/bin: $PATH" > >. Bashrc
Eval "$(pyenv init -)" >>. Bashrc.
Eval "$(pyenv virtualenv-init -)" >>. Basic.
Source. bashrc

How can I persist the configuration of pyenv in docker image?

jianyi
  • 151
  • 1
  • 3
  • 11

1 Answers1

0

When you run a image, it starts a container & when you exit that container & re-run the same image you won't see your changes. This is an expected behavior, docker is designed in this way. In case you want changes to be persistent you need to commit container changes to create a new image. Now post commit when you run the newer image, you should be able to see your changes made recently in your container.

Run a container -

$ docker run -it image

Commit container to a new image -

$ docker commit $CONTAINER_ID image

Re-run the image -

$ docker run -it image

vivekyad4v
  • 13,321
  • 4
  • 55
  • 63
  • I have submitted the container, because I once again after the operation only need to configure the pyenv doesn't have to reinstall it can normal use, so I want to say may not be your problem, I still don't know how to do @vivekyad4v – jianyi Jan 19 '18 at 14:48