Skip to content

Commit 71a40f9

Browse files
committed
dovecot, postfix: fix uid and gid
1 parent 7f7e090 commit 71a40f9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

dovecot/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ ARG POSTFIX_GID=4005
44
ARG DOVECOT_UID=4006
55
ARG DOVECOT_GID=4006
66
RUN apt-get update && apt-get install -qy dovecot-core dovecot-imapd
7-
RUN useradd -u $POSTFIX_UID -g $POSTFIX_GID -s /bin/false postfix
8-
RUN useradd -u $DOVECOT_UID -g $DOVECOT_GID -s /bin/false dovecot
7+
8+
RUN groupadd postfix -g $POSTFIX_GID && \
9+
useradd postfix -u ${POSTFIX_UID} -g postfix -s /bin/false && \
10+
gpasswd -a mail postfix
11+
12+
RUN groupmod dovecot -g ${DOVECOT_GID} && \
13+
usermod dovecot -u $DOVECOT_UID -g $DOVECOT_GID -s /bin/false
914

1015
CMD [ "/usr/sbin/dovecot", "-F" ]

postfix/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ ARG POSTFIX_UID=4005
44
ARG POSTFIX_GID=4005
55
ARG DOVECOT_UID=4006
66
ARG DOVECOT_GID=4006
7-
RUN apt-get update && apt-get install -qy postfix dovecot-core dovecot-imapd
8-
RUN useradd -u $POSTFIX_UID -g $POSTFIX_GID -s /bin/false postfix
9-
RUN useradd -u $DOVECOT_UID -g $DOVECOT_GID -s /bin/false dovecot
7+
RUN apt-get update && apt-get install -qy postfix
8+
9+
RUN groupadd -g ${DOVECOT_GID} dovecot && \
10+
useradd -u $DOVECOT_UID -g dovecot -s /bin/false dovecot
11+
RUN groupmod -g ${POSTFIX_GID} postfix && \
12+
usermod -u ${POSTFIX_UID} -g ${POSTFIX_GID} postfix
1013

1114
CMD [ "/usr/sbin/postfix" "start-fg" ]

0 commit comments

Comments
 (0)