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

Unable to override osrf/ros entrypoint

asked 2019-04-05 01:22:54 -0600

arwtyxouymz gravatar image


This is my first post and I'm very confusing about ROS + docker. What i want to do is to override osrf/ros entrypoints.

The entrypoint's difference is just added to source my workspace's setup.bash. This is my

#!/usr/bin/env bash
set -e

# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
source "/catkin_ws/devel/setup.bash"

exec "$@"

And I modified Dockerfile to create workspace and build package. This is my Dockerfile

FROM osrf/ros:kinetic-desktop-full

# For Nvidia GPU
RUN apt-get update && apt-get install -y --no-install-recommends \
    libxext-dev libx11-dev x11proto-gl-dev dh-autoreconf\
    && rm -rf /var/lib/apt/lists/ \
    && git clone && cd libglvnd \\
    && ./ && ./configure && make -j4 && make install

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    ros-kinetic-ridgeback-* \
    && mkdir -p /catkin_ws/src && cd /catkin_ws/src \
    && . /opt/ros/kinetic/ \
    && git clone \
    && rosdep install --from-path . -r -y --ignore-src \
    && rm -rf /var/lib/apt/lists/ \
    && cd /catkin_ws && catkin_make

COPY ./ /
RUN chmod +x /


CMD ["bash"]

Then, I run docker run -it <myimage>, docker container shutdown immediately. However, If i removed source "/catkin_ws/devel/setup.bash, container will start. So i think /catkin_ws/devel/setup.bash is a problem, but I don't know how to solve it because if i run docker logs <containerID> --details, no logs appeared.

Could someone help me?

I use Ubuntu:18.04 and melodic is installed in my local environment.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-05 11:44:19 -0600

Andrew Price gravatar image

The immediate shutdown is coming from the set -e flag in the entrypoint. I'm not sure what the problem with the develspace setup script is, but it happens on both the docker image you sent and the main workspace I'm using for my projects, so the error seems to be pretty pervasive. If someone knows how to error trace a bash script that would be helpful for debugging further, but you can get started by removing the set -e.

edit flag offensive delete link more


Thank you Andrew!

I removed set -e flag, and succeeded to run a container. But with docker-compose, ros cannot find my local package. This is my docker-compose.yaml

version: '2.3'

    build: .
    container_name: base
    runtime: nvidia
    privileged: true
      - "ROS_HOSTNAME=base"
      - "ROS_MASTER_URI=http://master:11311"
      - "DISPLAY=${DISPLAY}"
      - "QT_X11_NO_MITSHM=1"
      - "/tmp/.X11-unix:/tmp/.X11-unix:rw"
    command: rospack find ridgeback_base

If i executed docker-compose up, base container exited with status code 1 without flag set -e in my entrypoint. However, docker run -it --rm <image name> rospack find ridgeback_base is fine.

What's wrong?

arwtyxouymz gravatar image arwtyxouymz  ( 2019-04-06 04:07:32 -0600 )edit

@arwtyxouymz, that's probably best for another question, and I'm not super familiar with docker-compose. On my machine, running

docker build -f Dockerfile -t ros_answer .
docker run --rm -it ros_answer:latest rospack find ridgeback_base


Andrew Price gravatar image Andrew Price  ( 2019-04-08 12:36:50 -0600 )edit

Question Tools



Asked: 2019-04-05 01:22:54 -0600

Seen: 1,454 times

Last updated: Apr 05 '19