It seems that useradd
is not in amazonlinux docker base image.
useradd
will work when when my Dockerfile install openldap-devel, so RUN useradd my_user
will work when I my image have the following:
FROM amazonlinux
RUN yum -y install python3 \
gcc \
python3-pip \
python3-devel \
openldap-devel
When my image is just build from
FROM amazonlinux
RUN yum -y install python3 \
gcc \
python3-pip \
python3-devel
The command RUN useradd my_user
fails with the error message /bin/sh: useradd: command not found
How do I install useradd
in an amazonlinux base image without having to install all openldap-devel
I managed to figure out what package useradd
belongs by running the following command on an AmazonLinux EC2 machine:
$ yum whatprovides /usr/sbin/useradd
2:shadow-utils-4.1.5.1-24.amzn2.x86_64 : Utilities for managing accounts and shadow password files
Repo : amzn2-core
Matched from:
Filename : /usr/sbin/useradd
So changing my Dockerfile to the following made it work:
FROM amazonlinux
RUN yum -y install python3 \
python3-pip \
shadow-utils