FROM nvidia/cuda:11.4.3-cudnn8-devel-ubuntu18.04 ARG ROS_DISTRO=melodic # Setup user account ARG uid=1000 ARG gid=1000 ARG user=jasper RUN groupadd -r -f -g ${gid} ${user} && useradd -o -r -l -u ${uid} -g ${gid} -ms /bin/bash ${user} RUN usermod -aG sudo ${user} RUN echo "${user}:888888" | chpasswd ENV DEBIAN_FRONTEND=noninteractive ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics,display # [Optional] Add sudo support. Omit if you don't need to install software after connecting. RUN sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \ && apt-get update && apt-get install -y --no-install-recommends sudo \ curl \ gnupg2 \ lsb-release \ libgl1-mesa-dev \ libgl1-mesa-glx \ libglew-dev \ libosmesa6-dev \ software-properties-common \ libglvnd0 \ libgl1 \ libglx0 \ libegl1 \ libxext6 \ libx11-6 \ && rm -rf /var/lib/apt/lists/* RUN sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' \ && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - \ && apt-get update && apt-get install -y \ ros-melodic-desktop-full \ python-rosdep \ python-rosinstall \ python-rosinstall-generator \ python-wstool \ build-essential \ && rm -rf /var/lib/apt/lists/* # ******************************************************** # * Anything else you want to do like clean up goes here * # ******************************************************** RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/jasper/.bashrc \ && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc # [Optional] Set the default user. Omit if you want to keep the default as root. USER $user CMD ["/bin/bash"]