-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.dind
More file actions
115 lines (101 loc) · 3.31 KB
/
Copy pathDockerfile.dind
File metadata and controls
115 lines (101 loc) · 3.31 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
## Definite image args
ARG image_registry
ARG image_name=docker
ARG image_version=25.0-astra1.8.2-slim
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Base image #
# First stage, prepare environment #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM ${image_registry}${image_name}:${image_version} AS base-stage
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
ARG dind_additional_tools='curl sshpass jq xmlstarlet yq'
## ENV for build args
ENV \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TERM=linux \
TZ=Etc/UTC
## Install docker rootless mode and adapt for dind
## Always use the latest version available for the current DEB distribution
RUN \
--mount=type=bind,source=./scripts,target=/usr/local/sbin,readonly \
mkdir -p /run/program/divert/{bin,sbin,usr/bin,usr/sbin,lib/x86_64-linux-gnu,lib64} \
&& apt-install.sh \
## Dind tools
docker.io \
## Dockerd tools
## cert generate
openssl \
## storage driver BTRFS
btrfs-progs \
## EXT2/3/4 fs and raw disk
e2fsprogs \
## XFS fs
xfsprogs \
## network configuration
iptables \
## parallel gzip use: tar --use-compress-program=pigz
pigz \
## ip
iproute2 \
## modprobe
kmod \
## SCM
git \
## Additional tools
${dind_additional_tools} \
## Set environment
&& docker-set-environment.sh "docker.io" "dind" \
## Remove cache
&& apt-clean.sh \
## Smoke test
&& dockerd --version \
&& containerd --version \
&& ctr --version \
&& runc --version
## Prune unused files
RUN \
find /tmp/ ! -type d -ls -delete \
&& { \
find /run/ -mindepth 1 -ls -delete || :; \
} \
## Get image package dump
&& mkdir -p /usr/share/rocks \
&& ( \
echo "# os-release" && cat /etc/os-release \
&& echo "# dpkg-query" \
&& dpkg-query -f \
'${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' \
-W \
) >/usr/share/rocks/dpkg.query \
## Ensure '.exe' extension is not exits
&& find "/usr/" -iname '*.exe' -ls -delete \
&& install -d -m 01777 /run/lock
COPY ./configuration/dockerd-entrypoint.sh /usr/local/bin/
COPY ./configuration/dind.sh /usr/local/bin/
COPY ./configuration/docker-entrypoint-cli.sh /usr/local/bin/docker-entrypoint.sh
COPY ./configuration/modprobe.sh /usr/local/bin/modprobe
## Deduplication clean
RUN --mount=type=bind,source=./scripts,target=/usr/local/sbin,readonly dedup-clean.sh /usr/
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Final image #
# Second stage, compact optimize layer #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
FROM scratch
COPY --from=base-stage / /
## Set base label
LABEL \
maintainer="Vladislav Avdeev" \
organization="NGRSoftlab"
## Set environment
ENV \
LANG='en_US.UTF8' \
LC_ALL='en_US.UTF8' \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
TERM='xterm-256color' \
TZ=Etc/UTC \
DEBIAN_FRONTEND='noninteractive'
VOLUME /var/lib/docker
EXPOSE 2375 2376
ENTRYPOINT [ "dockerd-entrypoint.sh" ]
CMD []