生成时无法在docker中获取asdf direnv工作
我试图在docker中使用生成时无法在docker中获取asdf direnv工作,docker,asdf,asdf-vm,direnv,Docker,Asdf,Asdf Vm,Direnv,我试图在docker中使用asdf direnv。在asdf direnv之后,我创建了这个Dockerfile FROM nvidia/cuda:10.2-devel-ubuntu18.04 RUN chsh -s /bin/bash SHELL ["/bin/bash", "-ic", "-l"] ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update # Pytho
asdf direnv
。在asdf direnv
之后,我创建了这个Dockerfile
FROM nvidia/cuda:10.2-devel-ubuntu18.04
RUN chsh -s /bin/bash
SHELL ["/bin/bash", "-ic", "-l"]
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
# Python
RUN apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# Utils
RUN apt-get install -y git
RUN apt-get clean
WORKDIR /venv
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
RUN echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc
RUN echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrc
RUN asdf plugin add direnv
RUN asdf install direnv 2.28.0
RUN asdf local direnv 2.28.0
RUN echo "eval \"\$(asdf exec direnv hook bash)\"" >> ~/.bashrc
RUN echo "direnv() { asdf exec direnv \"\$@\"; }" >> ~/.bashrc
RUN mkdir -p ~/.config/direnv/
RUN echo "source \"\$(asdf direnv hook asdf)\"" >> ~/.config/direnv/direnvrc
RUN echo "export DIRENV_LOG_FORMAT=" >> ~/.config/direnv/direnvrc
RUN asdf plugin add python
RUN asdf install python 3.8.7
RUN asdf local python 3.8.7
RUN echo "use asdf" >> .envrc
RUN echo "layout python" >> .envrc
RUN direnv allow
RUN echo $(which python)
CMD ["/bin/bash"]
问题是,行runecho$(哪种python)
在我运行时正常工作,但在构建映像时却不能正常工作。我得到
构建docker build时-t venv gpu-f docker gpu/Dockerfile/root/.asdf/shimmes/python
docker运行时--gpus all-it-venv-gpu/venv/.direnv/python-3.8.7/bin/python