我有一个用于一些 lua 和 torch 相关任务的 Dockerfile,我正在尝试使用 luarocks 安装一些岩石。
FROM ubuntu:14.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update -y
RUN apt-get install -y curl git
RUN curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
RUN git clone https://github.com/torch/distro.git ~/torch --recursive
RUN cd ~/torch; ./install.sh
RUN source ~/.bashrc
RUN luarocks install nngraph
RUN luarocks install optim
RUN luarocks install nn
RUN luarocks install cltorch
RUN luarocks install clnn
docker build
运行良好,直到第一个 luarocks 调用:RUN luarocks install nngraph
此时它停止并抛出错误:
/bin/sh: luarocks: command not found
如果我注释掉 luarocks 行,构建运行良好。使用该图像,我可以创建一个容器并使用 bash,按预期运行 luarocks。
当然,我并不是特别希望每次启动容器时都必须这样做,所以我想知道是否有什么我可以做的。我有一种感觉,这个问题与线路有关,RUN rm /bin/sh && ln -s /bin/bash /bin/sh
但我需要能够运行线路RUN source ~/.bashrc
。
谢谢。