ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't know whether this is the cause of your trouble, but: ros_entrypoint.sh is not a file to source.

It's a wrapper shell script that sources the correct setup.bash for you and then invokes whatever you passed it in that new environment (from osrf/docker_images/ros/indigo/ubuntu/trusty/ros-core/ros_entrypoint.sh):

#!/bin/bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"

This file is then configured as the ENTRYPOINT of your Docker container, and will be run / prefixed everytime you spin up a container.

I don't know whether this is the cause of your trouble, but: ros_entrypoint.sh is not a file to source.

It's a wrapper shell script that sources the correct setup.bash for you and then invokes whatever you passed it in that new environment (from osrf/docker_images/ros/indigo/ubuntu/trusty/ros-core/ros_entrypoint.sh):

#!/bin/bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"

This file is then configured as the ENTRYPOINT of your Docker container, and will be run / prefixed everytime you spin up a container.

In a way, when you run the following:

$ docker run -it --rm ros:indigo rostopic echo /some_topic

it does this (inside the container):

$ /entrypoint.sh rostopic echo /some_topic

Which then first sources /opt/ros/indigo/setup.bash (as this is an Indigo image) and then runs rostopic echo /some_topic in that same bash session.

I don't know whether this is the cause of your trouble, but: The problem here is most likely that ros_entrypoint.sh is not a file to source.

It's a wrapper shell script that sources the correct setup.bash for you and then invokes whatever you passed it in that new environment (from osrf/docker_images/ros/indigo/ubuntu/trusty/ros-core/ros_entrypoint.sh):

#!/bin/bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"

This file is then configured as the ENTRYPOINT of your Docker container, and will be run / prefixed everytime you spin up a container.

In a way, when you run the following:

$ docker run -it --rm ros:indigo rostopic echo /some_topic

it does this (inside the container):

$ /entrypoint.sh rostopic echo /some_topic

Which then first sources /opt/ros/indigo/setup.bash (as this is an Indigo image) and then runs rostopic echo /some_topic in that same bash session.

According to bash-hackers.org/commands/builtin/exec, exec replaces the current shell and will terminate if it cannot execute what you ask it to.

If you source the file, it could be that you actually end up in the exec line, which after asking it to cd to a non-existing directory terminates and as the Docker session now has no active programs any more, it also exits, leaving you at the bash prompt of your host's terminal.

The problem here is most likely that tl;dr: ros_entrypoint.sh is not a file to source.


It's a wrapper shell script that sources the correct setup.bash for you and then invokes whatever you passed it in that new environment (from osrf/docker_images/ros/indigo/ubuntu/trusty/ros-core/ros_entrypoint.sh):

#!/bin/bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"

This file is then configured as the ENTRYPOINT of your Docker container, and will be run / prefixed everytime you spin up a container.

In a way, when you run the following:

$ docker run -it --rm ros:indigo rostopic echo /some_topic

it does this (inside the container):

$ /entrypoint.sh rostopic echo /some_topic

Which then first sources /opt/ros/indigo/setup.bash (as this is an Indigo image) and then runs rostopic echo /some_topic in that same bash session.

According to bash-hackers.org/commands/builtin/exec, exec replaces the current shell and will terminate if it cannot execute what you ask it to.

If you source the file, it could be that you actually end up in the exec line, which after asking it to cd to a non-existing directory terminates and as the Docker session now has no active programs any more, it also exits, leaving you at the bash prompt of your host's terminal.

tl;dr: ros_entrypoint.sh is not a file to source.


It's a wrapper shell script that sources the correct setup.bash for you and then invokes whatever you passed it in that new environment (from osrf/docker_images/ros/indigo/ubuntu/trusty/ros-core/ros_entrypoint.sh):

#!/bin/bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"

This file is then configured as the ENTRYPOINT of your Docker container, and will be run / prefixed everytime you spin up a container.

In a way, when you run the following:

$ docker run -it --rm ros:indigo rostopic echo /some_topic

it does this (inside the container):

$ /entrypoint.sh rostopic echo /some_topic

Which then first sources /opt/ros/indigo/setup.bash (as this is an Indigo image) and then runs rostopic echo /some_topic in that same bash session.

According to bash-hackers.org/commands/builtin/exec, exec replaces the current shell and will terminate if it cannot execute what you ask it to.

If you source the file, it could be that you actually end up in the exec line, which after asking it to cd to a non-existing directory terminates and as the Docker session now has no active programs any more, it also exits, leaving you at the bash prompt of your host's terminal.

tl;dr: ros_entrypoint.sh is not a file to source.


It's a wrapper shell script that sources the correct setup.bash for you and then invokes whatever you passed it in that new environment (from osrf/docker_images/ros/indigo/ubuntu/trusty/ros-core/ros_entrypoint.sh):

#!/bin/bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"

This file is then configured as the ENTRYPOINT of your Docker container, and will be run / prefixed everytime you spin up a container.

In a way, when you run the following:

$ docker run -it --rm ros:indigo rostopic echo /some_topic

it does this (inside the container):

/entrypoint.sh rostopic echo /some_topic

Which then first sources /opt/ros/indigo/setup.bash (as this is an Indigo image) and then runs rostopic echo /some_topic in that same bash session.environment.

According to bash-hackers.org/commands/builtin/exec, exec replaces the current shell and will terminate if it cannot execute what you ask it to.

If you source the file, it could be that you actually end up in the exec line, which after asking it to cd to a non-existing directory terminates and as the Docker session now has no active programs any more, it also exits, leaving you at the bash prompt of your host's terminal.