非阿尔卑斯丁德码头形象



是否存在现有的非Alpine dind docker映像?

绑定安装主机的docker插座对我不起作用。我需要合适的dind。Docker的dind图像似乎都是基于Alpine的,这对我来说也不起作用。

不完全是您问题的答案,但可能会解决您的需求:

我认为您并不真正需要非Alpine,而是需要启用GLIBC的映像。

我想要一个支持Docker的Gitlab CI的Docker镜像,它将拥有OpenJDK 12。这样的镜像还不可用——AdoptOpenJDK镜像没有DinD,官方的docker:*镜像也无法安装正常的OpenJDK。

所以我把adoptopenjdk:12docker:stable结合起来,它似乎起作用了。

docker build --label docker-with-openjdk12 .
# ------------------------------------------------------------------------------
#               NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
#                       PLEASE DO NOT EDIT IT DIRECTLY.
# ------------------------------------------------------------------------------
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM docker:stable
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
RUN apk add --no-cache --virtual .build-deps curl binutils 
    && GLIBC_VER="2.29-r0" 
    && ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" 
    && GCC_LIBS_URL="https://archive.archlinux.org/packages/g/gcc-libs/gcc-libs-9.1.0-2-x86_64.pkg.tar.xz" 
    && GCC_LIBS_SHA256="91dba90f3c20d32fcf7f1dbe91523653018aa0b8d2230b00f822f6722804cf08" 
    && ZLIB_URL="https://archive.archlinux.org/packages/z/zlib/zlib-1%3A1.2.11-3-x86_64.pkg.tar.xz" 
    && ZLIB_SHA256=17aede0b9f8baa789c5aa3f358fbf8c68a5f1228c5e6cba1a5dd34102ef4d4e5 
    && curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub 
    && SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2" 
    && echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - 
    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk 
    && apk add /tmp/glibc-${GLIBC_VER}.apk 
    && curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk 
    && apk add /tmp/glibc-bin-${GLIBC_VER}.apk 
    && curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk 
    && apk add /tmp/glibc-i18n-${GLIBC_VER}.apk 
    && /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true 
    && echo "export LANG=$LANG" > /etc/profile.d/locale.sh 
    && curl -LfsS ${GCC_LIBS_URL} -o /tmp/gcc-libs.tar.xz 
    && echo "${GCC_LIBS_SHA256} */tmp/gcc-libs.tar.xz" | sha256sum -c - 
    && mkdir /tmp/gcc 
    && tar -xf /tmp/gcc-libs.tar.xz -C /tmp/gcc 
    && mv /tmp/gcc/usr/lib/libgcc* /tmp/gcc/usr/lib/libstdc++* /usr/glibc-compat/lib 
    && strip /usr/glibc-compat/lib/libgcc_s.so.* /usr/glibc-compat/lib/libstdc++.so* 
    && curl -LfsS ${ZLIB_URL} -o /tmp/libz.tar.xz 
    && echo "${ZLIB_SHA256} */tmp/libz.tar.xz" | sha256sum -c - 
    && mkdir /tmp/libz 
    && tar -xf /tmp/libz.tar.xz -C /tmp/libz 
    && mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib 
    && apk del --purge .build-deps glibc-i18n 
    && rm -rf /tmp/*.apk /tmp/gcc /tmp/gcc-libs.tar.xz /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*
ENV JAVA_VERSION jdk-12.0.2+10
RUN set -eux; 
    apk add --virtual .fetch-deps curl; 
    ARCH="$(apk --print-arch)"; 
    case "${ARCH}" in 
       aarch64|arm64) 
         ESUM='855f046afc5a5230ad6da45a5c811194267acd1748f16b648bfe5710703fe8c6'; 
         BINARY_URL='https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_aarch64_linux_hotspot_12.0.2_10.tar.gz'; 
         ;; 
       armhf) 
         ESUM='9fec85826ffb7b2b2cf2853a6ed3e001b528ed5cf13e435cd13026398b5178d8'; 
         BINARY_URL='https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_arm_linux_hotspot_12.0.2_10.tar.gz'; 
         ;; 
       ppc64el|ppc64le) 
         ESUM='4b0c9f5cdea1b26d7f079fa6478aceebf1923c947c4209d5709c0869dd71b98f'; 
         BINARY_URL='https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_ppc64le_linux_hotspot_12.0.2_10.tar.gz'; 
         ;; 
       s390x) 
         ESUM='9897deeaf7a2c90374fbaca8b3eb8e63267d8fc1863b43b21c0bfc86e4783470'; 
         BINARY_URL='https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_s390x_linux_hotspot_12.0.2_10.tar.gz'; 
         ;; 
       amd64|x86_64) 
         ESUM='1202f536984c28d68681d51207a84b6c76e5998579132d3fe1b8085aa6a5f21e'; 
         BINARY_URL='https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_linux_hotspot_12.0.2_10.tar.gz'; 
         ;; 
       *) 
         echo "Unsupported arch: ${ARCH}"; 
         exit 1; 
         ;; 
    esac; 
    curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; 
    echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; 
    mkdir -p /opt/java/openjdk; 
    cd /opt/java/openjdk; 
    tar -xf /tmp/openjdk.tar.gz --strip-components=1; 
    apk del --purge .fetch-deps; 
    rm -rf /var/cache/apk/*; 
    rm -rf /tmp/openjdk.tar.gz;
ENV JAVA_HOME=/opt/java/openjdk 
    PATH="/opt/java/openjdk/bin:$PATH"
CMD ["jshell"]

您只想运行Docker在Jenkins中执行CI系统(构建、运行、将容器映像推送到hub)。Jenkins Master将启动Jenkins Slave作为容器,并在其中执行CI操作。

是的,您可以在jenkins slave容器中运行docker命令

我们需要jenkins slave容器中的Docker二进制文件,在这里,当通过Docker文件创建Docker映像时,我们已经向其添加了Docker二进制文件。

一旦构建了镜像,我们只需要在容器/var/run/docker.sock上批量安装主机的Docker sock /var/run/docker.sock

在这里,我们将从主机和Docker客户端执行Docker守护进程作为jenkins从属容器。

请参阅以下GIT和Docker Hub回购:

  • https://github.com/Nilesh7756/dind-jnlp-slave.git
  • https://hub.docker.com/r/nilesh7756/jnlp-slave/

相关内容

  • 没有找到相关文章

最新更新