-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.alpine
36 lines (34 loc) · 1.1 KB
/
Dockerfile.alpine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
ARG base_image=alpine:latest
FROM "$base_image"
RUN set -eux \
&& source /etc/os-release \
&& apk add --update --no-cache \
openrc \
&& sed -i 's/^\(tty\d\:\:\)/#\1/g' /etc/inittab \
&& sed -i \
-e 's/#rc_sys=".*"/rc_sys="docker"/g' \
-e 's/#rc_env_allow=".*"/rc_env_allow="\*"/g' \
-e 's/#rc_crashed_stop=.*/rc_crashed_stop=NO/g' \
-e 's/#rc_crashed_start=.*/rc_crashed_start=YES/g' \
-e 's/#rc_provide=".*"/rc_provide="loopback net"/g' \
/etc/rc.conf \
&& rm -f /etc/init.d/hwdrivers \
/etc/init.d/hwclock \
/etc/init.d/hwdrivers \
/etc/init.d/modules \
/etc/init.d/modules-load \
/etc/init.d/modloop \
&& case $VERSION_ID in \
3.21*) \
OPENRC_RUN="/usr/libexec/rc/sh/openrc-run.sh"; \
INIT="/usr/libexec/rc/sh/init.sh"; \
;; \
*) \
OPENRC_RUN="/lib/rc/sh/openrc-run.sh"; \
INIT="/lib/rc/sh/init.sh"; \
;; \
esac \
&& sed -i 's/cgroup_add_service /# cgroup_add_service /g' "$OPENRC_RUN" \
&& sed -i 's/VSERVER/DOCKER/Ig' "$INIT"
VOLUME ["/sys/fs/cgroup"]
CMD ["/sbin/init"]