File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -167,11 +167,19 @@ ARG GID=0
167
167
ARG USERNAME=kbuilder
168
168
ARG DOCKER_GID=999
169
169
170
- # Allow access docker socker in the host.
171
- RUN groupadd -g ${DOCKER_GID} "host-docker"
172
- RUN groupadd -g ${GID} "${USERNAME}"
173
- RUN useradd -d /h -u ${UID} -g ${GID} ${USERNAME}
174
- RUN adduser "${USERNAME}" "host-docker"
170
+ # Add a new user to the container image.
171
+ # To allow access to the docker socket on the host, we use the docker
172
+ # group on the host.
173
+
174
+ # First make sure the group exists. Ignore a failure in case
175
+ # there is already a group with that id.
176
+ RUN groupadd -g ${DOCKER_GID} "host-docker" | true
177
+
178
+ # Add a new user with the caller's uid and the docker goup id on the
179
+ # host.
180
+ RUN useradd -d /h -u ${UID} -g ${DOCKER_GID} ${USERNAME}
181
+
182
+ # Allow nopasswd sudo
175
183
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
176
184
177
185
CMD ["python3.6" ]
You can’t perform that action at this time.
0 commit comments