Skip to content

Commit 0b8df2f

Browse files
committed
replaced shadow utils
1 parent 0aa1053 commit 0b8df2f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ ENV MEM_SIZE="1G"
1313

1414
COPY --chmod=755 ./install-gosu.sh ./install-paper.sh ./docker-entrypoint.sh /usr/local/bin/
1515

16-
RUN yum install -y shadow-utils jq && \
17-
useradd -r -u ${PUID} mc && \
16+
RUN yum install -y jq && \
17+
echo "mc:x:${PUID}:${PUID}::/opt/minecraft:/sbin/nologin" >> /etc/passwd && \
18+
echo "mc:x:${PUID}:" >> /etc/group && \
1819
mkdir -p /opt/minecraft/data && \
1920
install-gosu.sh && \
2021
install-paper.sh

docker-entrypoint.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
if [ -n "${PUID}" ] && [ ! "${PUID}" = "$(id mc -u)" ]; then
5-
usermod -o -u "$PUID" mc
6-
echo "UID of mc user: $(id mc -u)"
4+
if [ -n "${PUID}" ] && [ ! "${PUID}" = "$(id -u mc)" ]; then
5+
echo "UID: $(id -u mc) -> ${PUID}"
6+
sed -i -E "s/^mc:([^:]*):[0-9]+:[0-9]+:/mc:\1:${PUID}:${PUID}:/" /etc/passwd
7+
sed -i -E "s/^mc:([^:]*):[0-9]+:/mc:\1:${PUID}:/" /etc/group
78
fi
89

910
chown -R mc /opt/minecraft

0 commit comments

Comments
 (0)