WebDec 9, 2024 · Dockerfileのビルドはbashではなくshで実行されるため、sourceコマンドを使おうとすると source : not found というエラーが出る。 shをbashへのシンボリックリンクで置き換えて、Dockerfileの終了時に元に戻すことで対応する。 例(pyenvへのpathを通して、pyenv経由でanacondaインストール) WebNov 17, 2015 · Source is not an executable ( source is a bash shell built-in command that executes the content of the file passed as argument) You should run source like this: docker run --rm -ti _image_name_ bash -c 'source FILE' Share Improve this answer Follow edited Mar 20, 2024 at 10:18 Community Bot 1 answered Nov 17, 2015 at 12:25 cristi 541 5 15
How to run a bash script from dockerfile - Stack Overflow
WebMar 29, 2024 · 1 Answer Sorted by: 1 In a Dockerfile, you cannot add the setup.bash to the .bashrc and then source the .bashrc. Instead, you want to source the setup.bash in one go: RUN /bin/bash -c 'source /opt/ros/kinetic/setup.bash &&\ mkdir -p ~/catkin_ws/src &&\ cd ~/catkin_ws/src &&\ #catkin_init_workspace &&\ cd ~/catkin_ws &&\ catkin_make' WebDec 2, 2024 · However, after I do that, every RUN command in the dockerfile stops working correctly. In the dockerfile below, the first 'ls /' produces the expected output, but the second one does not. This is not specific to 'ls', that's just a demo of the problem; every command I RUN after the ROS environment does not have the effect expected. ruby earrings yellow gold
Definition of a Dockerfile to use bash scripts on a …
WebOct 5, 2024 · You only source the file into the bash -c shell, so any variables you define in the file will not be available to the parent shell. As soon as the /bin/bash process ends, the variables are gone and you're back where you started. Just run . ~/.bashrc directly. – terdon Oct 5, 2024 at 8:49 Add a comment Your Answer Post Your Answer WebSep 21, 2024 · Sorted by: 2 You seem to have forgotten a slash in your command: cat ~.bashrc: No such file or directory It should be: cat ~/.bashrc Also everything you do with .bashrc in your Dockerfile is pointless. Web建议: 尽量使用官方镜像; 为了减小镜像体积,尽量依赖于现有镜像; 尽量少的使用指令构建过程中,每个指令都会构建一层,从而使镜像变得臃肿; 尝试使用docekr history来检查镜像层体积; 尝试使用多阶段Docker构建以减少镜像体积注: 可以分构建阶段、部署阶段; 格式 sc angel network