![]() Else, it will throw the error: /bin/bash: opt/ros/melodic/setup.bash: No such file or directory Side-note: do not forget the first "/" before "opt/./.". ![]() It needs cd /MY_PROJECT even if you have set WORKDIR. For example, mind that setting WORKDIR /MY_PROJECT before the bash commands in the Dockerfile does not affect the bash commands since the starting folder would have to be set in the ".bashrc" again. Or with the " " (which I would rather not use): RUN Įvery new RUN of a bash is isolated, "starting at 0". In the Dockerfile case, use the recommended RUN /bin/bash -c 'source /opt/ros/melodic/setup.bash' In other words, this problem can occur in any setting where the "sh" shell is used instead of the "bash", causing "/bin/sh: 1: MY_COMMAND: not found". Your shell is /bin/sh, but source expects /bin/bash, perhaps because it Taken from /bin/sh: 1: gvm: not found, which would say more or less: Since the "source" command works in the container MY_CONTAINER_NAME, how can I get the bash shell working in the underlying image MY_IMAGE_NAME during the docker build of the Dockerfile, instead of using the sh shell? ![]() _setup_util.py env.sh include local_setup.bash local_setup.zsh setup.sh shareīin etc lib local_setup.sh setup.bash lsīin etc lib local_setup.sh setup.bash setup.zshĪnd I could have just checked it directly anyway, works: source /opt/ros/melodic/setup.bash Now in the container, in the bash (which was loaded using /bin/bash above): cd cd cd ls By default, only the "build context", in this case where you start the Dockerfile, is not empty. How can it be not available in the image, then? docker run -dit -name MY_CONTAINER_NAME -v /opt/ros/melodic/ MY_IMAGE:latestĭocker exec -it MY_CONTAINER_NAME /bin/bashįyi: -v /opt/ros/melodic/ mounts the volume -v, else /opt/ros/melodic/ would be empty. Thus, the "source" command is available in the bash of the container. To test this, I created an image of a step before the error step, and checked the command inside the container: and it worked. executor failed running : exit code: 127 The following error appeared: => ERROR RUN source /opt/ros/melodic/setup.bash , using a Dockerfile for a ROS project, at line RUN source /opt/ros/melodic/setup.bash
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |