构建使用基础镜像
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

93 lines
2.3 KiB

FROM jenkins/inbound-agent:latest-alpine
USER root
RUN sed -i "s@https://dl-cdn.alpinelinux.org/@https://mirrors.huaweicloud.com/@g" /etc/apk/repositories; \
apk add --no-cache \
ca-certificates \
libc6-compat \
openssh-client
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
ENV DOCKER_VERSION 20.10.15
RUN set -eux; \
\
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
'x86_64') \
url='https://download.docker.com/linux/static/stable/x86_64/docker-20.10.15.tgz'; \
;; \
'armhf') \
url='https://download.docker.com/linux/static/stable/armel/docker-20.10.15.tgz'; \
;; \
'armv7') \
url='https://download.docker.com/linux/static/stable/armhf/docker-20.10.15.tgz'; \
;; \
'aarch64') \
url='https://download.docker.com/linux/static/stable/aarch64/docker-20.10.15.tgz'; \
;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
wget -O docker.tgz "$url"; \
\
tar --extract \
--file docker.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
\
dockerd --version; \
docker --version
COPY modprobe.sh /usr/local/bin/modprobe
COPY docker-entrypoint.sh /usr/local/bin/
ENV DOCKER_TLS_CERTDIR=/certs
RUN mkdir /certs /certs/client && chmod 1777 /certs /certs/client
RUN set -eux; \
apk add --no-cache \
btrfs-progs \
e2fsprogs \
e2fsprogs-extra \
ip6tables \
iptables \
openssl \
shadow-uidmap \
xfsprogs \
xz \
pigz \
; \
if zfs="$(apk info --no-cache --quiet zfs)" && [ -n "$zfs" ]; then \
apk add --no-cache zfs; \
fi
ENV DIND_COMMIT 42b1175eda071c0e9121e1d64345928384a93df1
RUN set -eux; \
addgroup -S dockremap; \
adduser -S -G dockremap dockremap; \
echo 'dockremap:165536:65536' >> /etc/subuid; \
echo 'dockremap:165536:65536' >> /etc/subgid; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind; \
sed -i '40i\nohup dockerd-entrypoint.sh > nohup.out 2>&1 &' /usr/local/bin/jenkins-agent; \
mkdir -p /root/.docker; \
echo $'{ \n\
"auths": { \n\
"repository.anxinyun.cn": { \n\
"auth": "YWRtaW46SGFyYm9yMTIzNDU=" \n\
} \n\
} \n\
}' >> /root/.docker/config.json
COPY dockerd-entrypoint.sh /usr/local/bin/
VOLUME /var/lib/docker
EXPOSE 2375 2376