Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Can install asdf inside Docker container, but not at build time via Dockerfile

$
0
0

I have a Dockerfile in which I am trying to install and use asdf to manage Python package versions. A snippet of my Dockerfile appears below.

SHELL ["/bin/bash", "-c"] RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0RUN chmod +x ~/.asdf/asdf.sh ~/.asdf/completions/asdf.bashRUN echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrcRUN echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrcENV PATH="$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH"ENV PATH="$HOME/.asdf:$PATH"RUN echo -e '\nsource $HOME/.asdf/asdf.sh'>> ~/.bashrcRUN source ~/.bashrcRUN bash -c 'echo -e which asdf'RUN asdf plugin-add python

That last line is the offending line. When I try to build this Docker image, I get the following.

 => ERROR [17/19] RUN asdf plugin-add python                                                                                                                    0.3s------> [17/19] RUN asdf plugin-add python:#21 0.292 /bin/bash: asdf: command not found------executor failed running [/bin/bash -c asdf plugin-add python]: exit code: 127

However, if I remove that line, I'm able to run a container and then just immediately run asdf successfully.

docker run -it <image ID>root:# asdf plugin-add pythoninitializing plugin repository...Cloning into '/root/.asdf/repository'...<etc>

Why doesn't this work when I try to run it through the Dockerfile?


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>