osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
559 stars 73 forks source link

Fix os detection for non-root images (cont.) #150

Closed miguelprada closed 3 years ago

miguelprada commented 3 years ago

This is a continuation of #149. I made the mistake of opening the PR directly from a branch in my colleague's fork without realizing I don't have push access to that. Apologies for the inconvenience.

I think this PR also addresses the comment by @tfoote by appending the chmod onto the previous RUN command.

As for the reproduction example, you can trigger the error by creating an image with a non-root user, and then try to run that image with the --nvidia flag.

For instance, this

mkdir -p /tmp/context && cd /tmp/context
cat <<EOF > Dockerfile
FROM ros:melodic
RUN useradd -ms /bin/bash someuser
USER someuser
EOF
docker build -t deletethis .
rocker --nvidia deletethis

fails for me on main, whereas it passes ok with the fix.