Help us understand the problem. What is going on with this article?

Alpineのユーザー追加にハマった話

More than 3 years have passed since last update.

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

修正したら問題なくビルド出来ました

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした