cuda11.4-ros-melodic.Dockerfile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. FROM nvidia/cuda:11.4.3-cudnn8-devel-ubuntu18.04
  2. ARG ROS_DISTRO=melodic
  3. # Setup user account
  4. ARG uid=1000
  5. ARG gid=1000
  6. ARG user=jasper
  7. RUN groupadd -r -f -g ${gid} ${user} && useradd -o -r -l -u ${uid} -g ${gid} -ms /bin/bash ${user}
  8. RUN usermod -aG sudo ${user}
  9. RUN echo "${user}:888888" | chpasswd
  10. ENV DEBIAN_FRONTEND=noninteractive
  11. ENV NVIDIA_VISIBLE_DEVICES all
  12. ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics,display
  13. # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
  14. RUN sed -i 's/http:\/\/archive.ubuntu.com\//http:\/\/mirrors.aliyun.com\//g' /etc/apt/sources.list \
  15. && apt-get update && apt-get install -y --no-install-recommends sudo \
  16. curl \
  17. gnupg2 \
  18. lsb-release \
  19. libgl1-mesa-dev \
  20. libgl1-mesa-glx \
  21. libglew-dev \
  22. libosmesa6-dev \
  23. software-properties-common \
  24. libglvnd0 \
  25. libgl1 \
  26. libglx0 \
  27. libegl1 \
  28. libxext6 \
  29. libx11-6 \
  30. && rm -rf /var/lib/apt/lists/*
  31. RUN sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' \
  32. && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - \
  33. && apt-get update && apt-get install -y \
  34. ros-melodic-desktop-full \
  35. python-rosdep \
  36. python-rosinstall \
  37. python-rosinstall-generator \
  38. python-wstool \
  39. build-essential \
  40. && rm -rf /var/lib/apt/lists/*
  41. # ********************************************************
  42. # * Anything else you want to do like clean up goes here *
  43. # ********************************************************
  44. RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/jasper/.bashrc \
  45. && echo 'cd ~/Work/Robot' >> /home/jasper/.bashrc
  46. # [Optional] Set the default user. Omit if you want to keep the default as root.
  47. USER $user
  48. CMD ["/bin/bash"]