23 lines
640 B
Plaintext
23 lines
640 B
Plaintext
# Create user 'agama' and add them to 'sudo' for sudo access and set
|
|
# the passwd to 'agama'
|
|
|
|
FROM agama AS agama-user
|
|
|
|
RUN apt-get -q update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
|
sudo \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
|
|
|
|
# NOTE: Requires 'sudo' package to already be installed
|
|
RUN groupadd -r agama \
|
|
&& useradd --no-log-init \
|
|
-s /bin/bash \
|
|
-r -m \
|
|
-g agama \
|
|
-G sudo \
|
|
-p $(echo "agama" | openssl passwd -stdin) agama
|
|
|
|
# Set 'sudo' to NOPASSWD for all container users
|
|
RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers
|