Reputation: 145
I have pulled up the centos:latest
Docker image which has an initial size of around 250 MB. After adding the lines below to create a group and add a user to the group the size of the docker image is ballooning to 22.7 GB.
I am not able to figure out why size is getting increased so much. Any ideas?
Here is the complete docker file:
FROM centos:latest
# Add x_user user
ARG user=x_user
ARG group=lxs_x_user
ARG uid=11111
ARG gid=22222
# Set environment variables
ENV HOME_DIR=/home/"$user"
ENV BASHRC_PATH=/home/"$user"/.bashrc
ENV SHELL=/bin/bash
# Create group
RUN groupadd --gid "$gid" --system "$group"
# Create user and add to the group
RUN useradd -G "$group" "$user" \
--uid "$uid" \
--gid "$gid" \
--home-dir "$HOME_DIR"
Upvotes: 3
Views: 1041
Reputation: 145
Adding the --no-log-init
flag resolved the problem.
RUN useradd -G "$group" "$user" \
--uid "$uid" \
--gid "$gid" \
--home-dir "$HOME_DIR" \
--no-log-init
https://github.com/moby/moby/issues/5419
Upvotes: 4