osrf / rocker

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

/tmp/detect_os fails, can't run rocker #127

Closed gurnarok closed 3 years ago

gurnarok commented 3 years ago

Hi, I am trying to start gazebo with rocker, using the basic command of: rocker --nvidia --x11 osrf/ros:melodic-desktop-full gazebo

But I get the following error output:

$ rocker --nvidia --x11 osrf/ros:melodic-desktop-full gazebo
Active extensions ['nvidia', 'x11']
Step 1/12 : FROM python:3-stretch as detector
 ---> b9d77e48a75c
Step 2/12 : RUN mkdir -p /tmp/distrovenv
 ---> Using cache
 ---> c1f550ffd51e
Step 3/12 : RUN python3 -m venv /tmp/distrovenv
 ---> Using cache
 ---> fc4eca7120eb
Step 4/12 : RUN . /tmp/distrovenv/bin/activate && pip install distro pyinstaller==4.0 staticx
 ---> Using cache
 ---> df8d75faead9
Step 5/12 : RUN apt-get update && apt-get install -qy patchelf #needed for staticx
 ---> Using cache
 ---> f49bc3abf7ea
Step 6/12 : RUN echo 'import distro; import sys; output = distro.linux_distribution(); print(output) if output[0] else sys.exit(1)' > /tmp/distrovenv/detect_os.py
 ---> Using cache
 ---> 6bf76b075c42
Step 7/12 : RUN . /tmp/distrovenv/bin/activate && pyinstaller --onefile /tmp/distrovenv/detect_os.py
 ---> Using cache
 ---> cdc07e0dfc5f
Step 8/12 : RUN . /tmp/distrovenv/bin/activate && staticx /dist/detect_os /dist/detect_os_static
 ---> Using cache
 ---> 35fab28a6595
Step 9/12 : FROM osrf/ros:melodic-desktop-full
 ---> 636cbf5fdaab
Step 10/12 : COPY --from=detector /dist/detect_os_static /tmp/detect_os
 ---> Using cache
 ---> 5ca8f768e9cf
Step 11/12 : ENTRYPOINT [ "/tmp/detect_os" ]
 ---> Using cache
 ---> 33f74df7b374
Step 12/12 : CMD [ "" ]
 ---> Using cache
 ---> 74f79941a8af
Successfully built 74f79941a8af
running,  docker run -it --rm 74f79941a8af
output:  Unable to find image '74f79941a8af:latest' locally
docker: Error response from daemon: pull access denied for 74f79941a8af, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

/tmp/detect_os failed:
> Unable to find image '74f79941a8af:latest' locally
> docker: Error response from daemon: pull access denied for 74f79941a8af, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
> See 'docker run --help'.
WARNING unable to detect os for base image 'osrf/ros:melodic-desktop-full', maybe the base image does not exist

What could be causing this?

OS: Ubuntu 20.04 rocker 0.2.3 Docker version 20.10.5, build 55c4c88 Python 3.8.5

gurnarok commented 3 years ago

I think this was caused by having installed docker-py through pip.

After uninstalling docker-py, I was able to start rocker.

gurnarok commented 3 years ago

Confirmed that this is the problem.

Installed docker-py through pip, tried to run rocker with the following command:

hannu@Terra:~$ rocker --nvidia --x11 osrf/ros:melodic-desktop-full gazebo
usage: rocker [-h] [--noexecute] [--nocache] [--nocleanup] [--pull] [-v] [--dev-helpers] [--devices [DEVICES [DEVICES ...]]] [--env NAME[=VALUE] [NAME[=VALUE] ...]] [--env-file ENV_FILE] [--git] [--home] [--name NAME] image [command [command ...]]
rocker: error: DependencyMissing encountered: Docker Client failed to connect to docker daemon. Please verify that docker is installed and running. As well as that you have permission to access the docker daemon. This is usually by being a member of the docker group.

hannu@Terra:~$ groups hannu
hannu : hannu adm cdrom sudo dip plugdev lpadmin lxd sambashare docker

hannu@Terra:~$ pip3 uninstall docker-py
Found existing installation: docker-py 1.10.6
Uninstalling docker-py-1.10.6:
  Would remove:
    /home/hannu/.local/lib/python3.8/site-packages/docker/*
    /home/hannu/.local/lib/python3.8/site-packages/docker_py-1.10.6.dist-info/*
Proceed (y/n)? y
  Successfully uninstalled docker-py-1.10.6

After that, rerunning rocker command, I got Gazebo to show up.

tfoote commented 3 years ago

Thanks for the followup that can help others in the future.

StefanFabian commented 3 years ago

Just want to add another reason why this might fail with:

Successfully built a9b5d1f0dae0
running,  docker run -it --rm a9b5d1f0dae0
output:  standard_init_linux.go:228: exec user process caused: permission denied

/tmp/detect_os failed:
> standard_init_linux.go:228: exec user process caused: permission denied
WARNING unable to detect os for base image 'docker-image-name' maybe the base image does not exist

is if your dockerfile creates a user since rocker seems to expect to be root.