【发布时间】:2019-06-23 18:23:21
【问题描述】:
这只是一个令我困惑的 Dockefile 的一部分。顺便说一句,它有一些额外的调试行。在第一行中,我创建了 /home/ubuntu/.bashrc。然而,在最后一行,它的行为就好像它无法运行一样。
RUN echo 'source /opt/ros/kinetic/setup.bash' >> /home/ubuntu/.bashrc
RUN echo 'source /home/ubuntu/catkin_ws/devel/setup.bash' >> /home/ubuntu/.bashrc
RUN /bin/bash -c "echo 'export HOME=/home/ubuntu' >> /root/.bashrc && source /root/.bashrc"
RUN pwd
RUN cd ~ && pwd
RUN cat /home/ubuntu/.bashrc
RUN mkdir -p ~/catkin_ws/src
RUN source /home/ubuntu/.bashrc && \
cd ~/catkin_ws/src && \
/opt/ros/kinetic/bin/catkin_init_workspace && \
cd ~/catkin_ws && \
catkin_make
这是输出:
Step 13/32 : RUN echo 'source /opt/ros/kinetic/setup.bash' >> /home/ubuntu/.bashrc
---> Using cache
---> a60c2d1482d8
Step 14/32 : RUN echo 'source /home/ubuntu/catkin_ws/devel/setup.bash' >> /home/ubuntu/.bashrc
---> Using cache
---> 3be964ee0c36
Step 15/32 : RUN /bin/bash -c "echo 'export HOME=/home/ubuntu' >> /root/.bashrc && source /root/.bashrc"
---> Using cache
---> 83cf2e5f4b1c
Step 16/32 : RUN pwd
---> Using cache
---> 40915ecc834d
Step 17/32 : RUN cd ~ && pwd
---> Using cache
---> 92f2cee78a48
Step 18/32 : RUN cat /home/ubuntu/.bashrc
---> Using cache
---> c8f467775b33
Step 19/32 : RUN mkdir -p ~/catkin_ws/src
---> Using cache
---> 53e5c403949f
Step 20/32 : RUN source /home/ubuntu/.bashrc && cd ~/catkin_ws/src && /opt/ros/kinetic/bin/catkin_init_workspace && cd ~/catkin_ws && catkin_make
---> Running in 708d485325e2
/bin/sh: 1: source: not found
The command '/bin/sh -c source /home/ubuntu/.bashrc && cd ~/catkin_ws/src && /opt/ros/kinetic/bin/catkin_init_workspace && cd ~/catkin_ws && catkin_make' returned a non-zero code: 127
当然,这是我的错误,但我看不到它,也看不到我理解上的差距。谢谢!
【问题讨论】:
-
这应该会有所帮助 - stackoverflow.com/a/25086628/1421222
标签: docker