fix: Improve docker example first user experience (#4972)

The base ubuntu image lands the user as root, but the terraform tempalte
expected /home/coder to be used. This change adds a user with the same
name as the Coder users username and allows them to sudo.
This commit is contained in:
Mathias Fredriksson
2022-11-10 12:55:39 +02:00
committed by GitHub
parent 4885ecc3ad
commit 570a1ffc2b
2 changed files with 25 additions and 3 deletions
+16 -1
View File
@@ -1,3 +1,18 @@
FROM ubuntu
RUN apt-get update && apt-get install -y curl wget git vim golang
RUN apt-get update \
&& apt-get install -y \
curl \
git \
golang \
sudo \
vim \
wget \
&& rm -rf /var/lib/apt/lists/*
ARG USER=coder
RUN useradd --groups sudo --no-create-home ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
USER ${USER}
WORKDIR /home/${USER}