Loading...

Use usermod and groupmod in Alpine Linux Docker Images

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

Elastic uses Alpine Linux as base image for their Elasticsearch docker images. Since v5.3.1 there will be no more supported docker images on dockerhub with Debian, it made it necessary to rewrite my docker files for my company. One obstacle is to assign the elasticsearch user to a specific uid and gid on the docker host system.

Deprecated images

Since I’m not familiar with Alpine Linux I had to investigate a little. To have usermod and groupmod, I have to install the shadow package.

# change uid and gid for elasticsearch user
RUN apk --no-cache add shadow && \
    usermod -u 2500 elasticsearch && \
    groupmod -g 2500 elasticsearch
Please remember the terms for blog comments.