luigifreda / rosdocker

This repository contains a set of tools that simplifies the management of docker containers and (ROS) images with transparent support of NVIDIA drivers.
16 stars 2 forks source link

Errors when create more than 2 containers #4

Closed LoganCome closed 2 weeks ago

LoganCome commented 2 weeks ago

When I create another container:

sudo ./build.sh noetic
[sudo] password for boyee: 
WORKING_FOLDER_TO_MOUNT_IN_CONTAINER: /root/Work
USE_LOCAL_HOME_FOLDER: 0
Using NVIDIA DRIVER: 535
CONTAINER_NAME=noetic
building container noetic with Dockerfile_noetic
[+] Building 2.0s (19/26)                                                                                                                                     docker:default
 => [internal] load build definition from Dockerfile_noetic                                                                                                             0.0s
 => => transferring dockerfile: 2.65kB                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/ros:noetic-ros-base-focal                                                                                            1.8s
 => [internal] load .dockerignore                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                         0.0s
 => [internal] load build context                                                                                                                                       0.0s
 => => transferring context: 32B                                                                                                                                        0.0s
 => [ 1/22] FROM docker.io/library/ros:noetic-ros-base-focal@sha256:e3866df3b9798c4f3b49946d61b179745a22409ee8ce7037411ea550581b12b4                                    0.0s
 => CACHED [ 2/22] RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get install -y keyboard-configuration                                                    0.0s
 => CACHED [ 3/22] RUN apt-get -y update && apt-get install -y screen tree sudo ssh synaptic psmisc aptitude gedit geany                                                0.0s
 => CACHED [ 4/22] RUN apt-get install -y git curl wget ca-certificates                                                                                                 0.0s
 => CACHED [ 5/22] RUN apt-get install -y mesa-utils                                                                                                                    0.0s
 => CACHED [ 6/22] RUN apt-get install -y libqt5core5a libqt5dbus5 libqt5gui5                                                                                           0.0s
 => CACHED [ 7/22] RUN apt-get install -y build-essential git                                                                                                           0.0s
 => CACHED [ 8/22] RUN apt-get install -y ros-noetic-desktop-full                                                                                                       0.0s
 => CACHED [ 9/22] RUN rm /etc/ros/rosdep/sources.list.d/20-default.list                                                                                                0.0s
 => CACHED [10/22] RUN rosdep init && rosdep update                                                                                                                     0.0s
 => CACHED [11/22] RUN apt-get install -y python3-pip                                                                                                                   0.0s
 => CACHED [12/22] RUN apt-get install -y python-is-python3                                                                                                             0.0s
 => CACHED [13/22] RUN pip3 install -U catkin_tools                                                                                                                     0.0s
 => CACHED [14/22] RUN apt-get install -y doxygen libssh2-1-dev libudev-dev                                                                                             0.0s
 => ERROR [15/22] RUN useradd root -m -s /bin/bash -u 0 -G sudo,dialout                                                                                                 0.2s
------                                                                                                                                                                       
 > [15/22] RUN useradd root -m -s /bin/bash -u 0 -G sudo,dialout:
0.203 useradd: user 'root' already exists
------
Dockerfile_noetic:70
--------------------
  68 |     VOLUME "${home}"
  69 |     
  70 | >>> RUN useradd ${user} -m -s ${shell} -u ${uid} -G sudo,dialout
  71 |     
  72 |     # Clone user into docker image and set up X11 sharing 
--------------------
ERROR: failed to solve: process "/bin/sh -c useradd ${user} -m -s ${shell} -u ${uid} -G sudo,dialout" did not complete successfully: exit code: 9
luigifreda commented 2 weeks ago

Hi, I see the problem. It was not expected that a root user in Linux creates a docker container. Do you really need to be root to manage your system? That's not suggested (may be dangerous) in your host system. Will have a look anyway.

LoganCome commented 2 weeks ago

@luigifreda Dear author, thanks for your information about the docker with root. I have change the way to create docker container and create container without root. There is no error no. Thanks a lot!