#Dockerfile
#alpine-image
FROM alpine
#user
RUN echo 'root:root' |chpasswd
RUN useradd -m walrein \
&& echo "walrein ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& echo 'walrein:walrein' | chpasswd
なんてことをしていたんですが、
[91m/bin/sh: /usr/sbin/useradd: not found
とか言われて検索したら
Best way to add user? #38
https://github.com/gliderlabs/docker-alpine/issues/38
このForumに助けられました
So, two things here:
There is a adduser that is handled by BusyBox. You are probably looking for adduser -S moxi.
You are trying to install a Debian package on Alpine. This won't work! You need either a musl compatible binary or a way to compile from source.
要はuseraddじゃなくてadduser使うんだよってことらしく
#alpine-image
FROM alpine
#user
RUN echo 'root:root' |chpasswd
RUN adduser -S walrein \
&& echo "walrein ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& echo 'walrein:walrein' | chpasswd
修正したら問題なくビルド出来ました