From 3163e1357524c68a4d92c86694286d557e543015 Mon Sep 17 00:00:00 2001 From: Sida Chen Date: Wed, 3 Apr 2019 15:24:32 -0400 Subject: [PATCH] Change RHEL to use sudo instead of use root user --- rhel7.Dockerfile | 8 ++++++-- sudoers.txt | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 sudoers.txt diff --git a/rhel7.Dockerfile b/rhel7.Dockerfile index 78c9f2b..f1e013a 100644 --- a/rhel7.Dockerfile +++ b/rhel7.Dockerfile @@ -27,7 +27,7 @@ RUN subscription-manager import --certificate=/tmp/${SUBSCRIPTION_KEY} RUN rm -f /tmp/${SUBSCRIPTION_KEY} # Install init system and Clair depended binaries -RUN yum install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False python-setuptools git rpm xz +RUN yum install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False python-setuptools git rpm xz sudo RUN rpm --version | grep -q 'version 4' # ensure rpm is version 4 RUN easy_install supervisor @@ -49,4 +49,8 @@ VOLUME /config VOLUME /certs EXPOSE 6060 6061 -CMD ["sh", "/boot.sh"] +RUN adduser username -u 1000 -G wheel +ADD sudoers.txt /etc/sudoers +USER username:wheel + +CMD ["sudo", "sh", "/boot.sh"] diff --git a/sudoers.txt b/sudoers.txt new file mode 100644 index 0000000..390c0e0 --- /dev/null +++ b/sudoers.txt @@ -0,0 +1 @@ +ALL ALL = (ALL) NOPASSWD: ALL \ No newline at end of file