Reputation: 3156
Using Ubuntu 16 plus Docker, can I create a user "myuser" that can use sudo
when necessary?
My Dockerfile looks roughly like:
FROM ubuntu:16.04
RUN \
adduser --system --disabled-password myuser \
&& \
usermod -a -G sudo myuser
USER myuser
WORKDIR /home/myuser
I tried small variations on that, with e.g. --ingroup sudo
in the adduser
command.
However, I cannot get "myuser" to be able to run sudo
. Instead I get sudo: command not found
messages.
Upvotes: 1
Views: 2530
Reputation: 70175
sudo
is not a binary which is included by default in modern ubuntu docker images (mostly because it's usually unnecessary to run sudo
inside of docker)
In order to get a sudo
binary you need to install it from apt
RUN apt-get update && apt-get install -y --no-install-recommends sudo
Upvotes: 3