forked from luigifreda/rosdocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_noetic_cuda
124 lines (90 loc) · 3.13 KB
/
Dockerfile_noetic_cuda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# from https://hub.docker.com/r/nvidia/cuda/tags?page=1&name=ubuntu20
FROM nvidia/cuda:11.6.1-devel-ubuntu20.04
# Arguments
ARG user
ARG uid
ARG home
ARG workspace
ARG shell
ARG nvidia_driver_version
ARG container_name
ARG timezone=Etc/UTC
LABEL maintainer="[email protected]"
ENV TZ=${timezone}
################################
ENV ROS_DISTRO=noetic
################################
RUN apt-get -y update &&DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata apt-utils keyboard-configuration
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get -y update && apt-get -y dist-upgrade
################################
# add the ROS deb repo to the apt sources list
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
wget \
gnupg2 \
lsb-release \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu focal main" | tee /etc/apt/sources.list.d/ros-focal.list'
RUN apt-get -y install curl
RUN sh -c 'curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -'
################################
# Basic Utilities
RUN apt-get -y update && apt-get install -y screen tree sudo ssh synaptic aptitude gedit geany
# Latest X11 / mesa GL
RUN apt-get install -y mesa-utils
# Dependencies required to build rviz
RUN apt-get install -y libqt5core5a libqt5dbus5 libqt5gui5
# ROS-desktop
RUN apt-get install -y ros-noetic-desktop-full
# Additional development tools
RUN apt-get install -y build-essential git
# Python
RUN apt-get install -y python3-pip
RUN apt-get install -y python-is-python3
RUN pip3 install -U catkin_tools
# ROS deps
RUN apt-get install -y \
#python-rosinstall \
#python-jinja2 \
doxygen \
libssh2-1-dev \
libudev-dev
################
SHELL ["/bin/bash", "-c"]
RUN source /opt/ros/noetic/setup.bash
################################
# from http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration (with nvidia-docker2)
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# Make SSH available
EXPOSE 22
# Mount the user's home directory
VOLUME "${home}"
RUN useradd ${user} -m -s ${shell} -u ${uid} -G sudo,dialout
# Clone user into docker image and set up X11 sharing
RUN \
echo "${user}:x:${uid}:${uid}:${user},,,:${home}:${shell}" >> /etc/passwd && \
echo "${user}:x:${uid}:" >> /etc/group && \
echo "${user} ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/${user}" && \
chmod 0440 "/etc/sudoers.d/${user}"
#RUN echo "${user} ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN echo "${user}:docker" | chpasswd
# this allows to switch to user with $ su -
RUN echo "root:docker" | chpasswd
# Switch to user
USER "${user}"
# This is required for sharing Xauthority
ENV QT_X11_NO_MITSHM=1
ENV CONTAINER_NAME="${container_name}"
# Switch to the workspace
WORKDIR ${workspace}
COPY ./bashrc_add ${home}/bashrc_add
RUN cat ${home}/bashrc_add >> "${home}/.bashrc"