/bin/sh: useradd: not found

FROM php:8.0.24-fpm-alpine

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
 # libonig-dev \ #no caso da imagen não ser alpine
 #oniguruma caso a imagem seja alpine
RUN apk update && apk add --no-cache  \
    git \
    curl \
    libpng-dev \
    libxml2-dev \
    zip \

# Clear cache
#RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
    chown -R $user:$user /home/$user

# Set working directory
WORKDIR /var/www

USER $user

and when i build the container i get this error

ERROR [stage-0 5/7] RUN useradd -G www-data,root -u 1000 -d /home/anderson anderson 0.6s

[stage-0 5/7] RUN useradd -G www-data,root -u 1000 -d /home/anderson anderson:
#0 0.561 /bin/sh: useradd: not found

failed to solve: executor failed running [/bin/sh -c useradd -G www-data,root -u $uid -d /home/$user $user]: exit code: 127

I googled it for you using the search terms “add user alpine”.
The first result is Setting up a new user - Alpine Linux.

After looking at the options on that page, the resulting command is:

adduser -G www-data,root -u $uid -h /home/$user $user