- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Docker Hub 上有这些自动构建:
作为引用,以下是两个 Dockerfile:
这是 arm32v7
构建的构建日志:
Building in Docker Cloud's infrastructure...
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Reset branch 'master'
Your branch is up-to-date with 'origin/master'.
Executing build hook...
Sending build context to Docker daemon 88.06kB
Step 1/17 : ARG ALPINE_VERSION="3.8"
Step 2/17 : ARG S6_OVERLAY_VERSION="1.21.7.0"
Step 3/17 : FROM golang:1.11-alpine${ALPINE_VERSION} AS builder
1.11-alpine3.8: Pulling from library/golang
169185f82c45: Pulling fs layer
34c29055ee42: Pulling fs layer
29802c64cdfc: Pulling fs layer
dd82873a5b09: Pulling fs layer
b711937b138a: Pulling fs layer
dd82873a5b09: Waiting
b711937b138a: Waiting
29802c64cdfc: Verifying Checksum
29802c64cdfc: Download complete
34c29055ee42: Verifying Checksum
34c29055ee42: Download complete
b711937b138a: Verifying Checksum
b711937b138a: Download complete
169185f82c45: Verifying Checksum
169185f82c45: Download complete
169185f82c45: Pull complete
34c29055ee42: Pull complete
29802c64cdfc: Pull complete
dd82873a5b09: Verifying Checksum
dd82873a5b09: Download complete
dd82873a5b09: Pull complete
b711937b138a: Pull complete
Digest: sha256:9657ef82d7ead12e0c88c7f4708e78b50c5fd3c1893ac0f2f0924ab98873aad8
Status: Downloaded newer image for golang:1.11-alpine3.8
---> be1230a1b343
Step 4/17 : RUN apk update && apk add --no-cache --virtual build-dependencies git && go get -u github.com/nmrshll/gphotos-uploader-cli/cmd/gphotos-uploader-cli && cd /go/src/github.com/nmrshll && rm -rf gphotos-uploader-cli && git clone https://github.com/rfgamaral/gphotos-uploader-cli.git --branch docker && rm -rf oauth2-noserver && git clone https://github.com/rfgamaral/oauth2-noserver.git --branch docker && cd gphotos-uploader-cli/cmd/gphotos-uploader-cli && GOOS=linux GOARCH=amd64 go build -ldflags='-w -s' -o /go/bin/gphotos-uploader-cli && apk del build-dependencies
---> Running in 79c1d68ad8b0
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.2-53-g53558ad6fc [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
v3.8.2-53-g53558ad6fc [http://dl-cdn.alpinelinux.org/alpine/v3.8/community]
OK: 9544 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/7) Installing nghttp2-libs (1.32.0-r0)
(2/7) Installing libssh2 (1.8.0-r3)
(3/7) Installing libcurl (7.61.1-r1)
(4/7) Installing expat (2.2.5-r0)
(5/7) Installing pcre2 (10.31-r0)
(6/7) Installing git (2.18.1-r0)
(7/7) Installing build-dependencies (0)
Executing busybox-1.28.4-r3.trigger
OK: 19 MiB in 21 packages
Cloning into 'gphotos-uploader-cli'...
Cloning into 'oauth2-noserver'...
(1/7) Purging build-dependencies (0)
(2/7) Purging git (2.18.1-r0)
(3/7) Purging libcurl (7.61.1-r1)
(4/7) Purging nghttp2-libs (1.32.0-r0)
(5/7) Purging libssh2 (1.8.0-r3)
(6/7) Purging expat (2.2.5-r0)
(7/7) Purging pcre2 (10.31-r0)
Executing busybox-1.28.4-r3.trigger
OK: 5 MiB in 14 packages
Removing intermediate container 79c1d68ad8b0
---> 17b221a9ee49
Step 5/17 : FROM amd64/alpine:${ALPINE_VERSION}
3.8: Pulling from amd64/alpine
169185f82c45: Already exists
Digest: sha256:616d0d0ff1583933ed10a7b3b4492899942016c0577d43a1c506c0aad8ab4da8
Status: Downloaded newer image for amd64/alpine:3.8
---> 491e0ff7a8d5
Step 6/17 : LABEL maintainer="master@ricardoamaral.net"
---> Running in e58b7fcdb220
Removing intermediate container e58b7fcdb220
---> c525e340a42d
Step 7/17 : ARG BUILD_DATE
---> Running in 0a9417e1adcd
Removing intermediate container 0a9417e1adcd
---> 9f6c69125803
Step 8/17 : ARG S6_OVERLAY_VERSION
---> Running in 93a8cd6996b9
Removing intermediate container 93a8cd6996b9
---> 6034d93430da
Step 9/17 : ARG VCS_REF
---> Running in 8f6fc7d81c71
Removing intermediate container 8f6fc7d81c71
---> 74180d38dbc0
Step 10/17 : LABEL org.label-schema.build-date="${BUILD_DATE}" org.label-schema.description="Mass upload media folders to your Google Photos account with this Docker image." org.label-schema.name="rfgamaral/gphotos-uploader" org.label-schema.schema-version="1.0" org.label-schema.vcs-ref="${VCS_REF}" org.label-schema.vcs-url="https://github.com/rfgamaral/docker-gphotos-uploader.git"
---> Running in 08cf19c6f46a
Removing intermediate container 08cf19c6f46a
---> 106104e2ef17
Step 11/17 : ENV GPU_SCHEDULE="0 */8 * * *"
---> Running in edea63c892b9
Removing intermediate container edea63c892b9
---> d69ae92742d2
Step 12/17 : ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-amd64.tar.gz /tmp/
---> a7448cda217f
Step 13/17 : RUN apk update && apk add --no-cache curl && tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && rm -rf /tmp/*
---> Running in 5d9ee7e3941d
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.2-53-g53558ad6fc [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
v3.8.2-53-g53558ad6fc [http://dl-cdn.alpinelinux.org/alpine/v3.8/community]
OK: 9544 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ca-certificates (20171114-r3)
(2/5) Installing nghttp2-libs (1.32.0-r0)
(3/5) Installing libssh2 (1.8.0-r3)
(4/5) Installing libcurl (7.61.1-r1)
(5/5) Installing curl (7.61.1-r1)
Executing busybox-1.28.4-r3.trigger
Executing ca-certificates-20171114-r3.trigger
OK: 6 MiB in 18 packages
Removing intermediate container 5d9ee7e3941d
---> 14fc569893de
Step 14/17 : COPY --from=builder /go/bin/gphotos-uploader-cli /usr/local/bin/gphotos-uploader-cli
---> 32fa657de51c
Step 15/17 : COPY rootfs/ /
---> 1639f6e639b4
Step 16/17 : VOLUME ["/config", "/photos"]
---> Running in 440d1d13cd60
Removing intermediate container 440d1d13cd60
---> fd730f9c1ebb
Step 17/17 : ENTRYPOINT ["/init"]
---> Running in 197c889006b2
Removing intermediate container 197c889006b2
---> 4e66fc7b481d
Successfully built 4e66fc7b481d
Successfully tagged rfgamaral/gphotos-uploader:latest-arm32v7
Pushing index.docker.io/rfgamaral/gphotos-uploader:latest-arm32v7...
Done!
Build finished
如您所见,日志仅引用了 amd64
,而不引用 arm32v7
或 armhf
,这些在 Dockerfile 中都清楚存在。 arm32v7 文件。 Docker Hub 为何发生变化:
arm32v7/alpine:${ALPINE_VERSION}
到 amd64/alpine:${ALPINE_VERSION}
s6-overlay-armhf.tar.gz
到 s6-overlay-amd64.tar.gz
GOARCH=arm GOARM=7
至 GOARCH=amd64
这就像使用 Dockerfile
而不是 Dockerfile.arm32v7
但 a) 这不是我在自动构建配置中为“Dockerfile 位置”选择的内容,b) Docker Hub 构建部分作为“Dockerfile”选项卡显示用于构建的 Dockerfile,并显示正确的文件。
这是 Docker Hub 上的错误还是我做错了什么?
最佳答案
经过一番研究,我解决了自己的问题...首先,我犯了一个愚蠢的错误,其次,我忘记了一件非常重要的事情。以下是我解决问题的方法:
虽然我为每个自动构建指定了不同的Dockerfile
,但我还有一个build
钩子(Hook),它覆盖了docker build
命令并且它所有构建都默认使用 Dockerfile
,而不是选择正确的文件。
修复了build
Hook 文件:
#!/bin/bash
docker build \
--file "${DOCKERFILE_PATH}" \
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
--tag "$IMAGE_NAME" \
.
就像 @JanGaraj 在他的回答中提到的那样,Docker Hub 在 amd64
上运行,因此它无法运行其他架构的二进制文件。如何使用 Docker Hub 自动构建构建多架构镜像?在qemu-user-static
的帮助下和更多的钩子(Hook)。我在this GitHub issue上找到了答案但我将在这里发布我的具体用例的完整答案:
我的示例项目树:
.
├── Dockerfile
├── Dockerfile.aarch64
├── Dockerfile.armhf
└── hooks
├── build
├── post_checkout
└── pre_build
post_checkout
Hook 文件:
#!/bin/bash
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2)
[ "${BUILD_ARCH}" == "Dockerfile" ] && \
{ echo 'qemu-user-static: Download not required for current arch'; exit 0; }
QEMU_USER_STATIC_ARCH=$([ "${BUILD_ARCH}" == "armhf" ] && echo "${BUILD_ARCH::-2}" || echo "${BUILD_ARCH}")
QEMU_USER_STATIC_DOWNLOAD_URL="https://github.com/multiarch/qemu-user-static/releases/download"
QEMU_USER_STATIC_LATEST_TAG=$(curl -s https://api.github.com/repos/multiarch/qemu-user-static/tags \
| grep 'name.*v[0-9]' \
| head -n 1 \
| cut -d '"' -f 4)
curl -SL "${QEMU_USER_STATIC_DOWNLOAD_URL}/${QEMU_USER_STATIC_LATEST_TAG}/x86_64_qemu-${QEMU_USER_STATIC_ARCH}-static.tar.gz" \
| tar xzv
pre_build
Hook 文件:
#!/bin/bash
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2)
[ "${BUILD_ARCH}" == "Dockerfile" ] && \
{ echo 'qemu-user-static: Registration not required for current arch'; exit 0; }
docker run --rm --privileged multiarch/qemu-user-static:register --reset
Dockerfile
文件:
FROM amd64/alpine:3.8
(...)
Dockerfile.aarch64
文件:
FROM arm64v8/alpine:3.8
COPY qemu-aarch64-static /usr/bin/
(...)
Dockerfile.armhf
文件:
FROM arm32v6/alpine:3.8
COPY qemu-arm-static /usr/bin/
(...)
就是这样!
关于docker - 如何使用 Docker Hub 在特定架构上构建 Docker 镜像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54578066/
我需要将 OCI 镜像 list 转换为 Docker v2.2 镜像格式,反之亦然。但我找不到两者之间的任何区别,是否有任何实际区别或它们相同? 最佳答案 Docker 镜像 list V 2,模式
LNMP 是代表 Linux 系统下的 Nginx、Mariadb、PHP 相结合而构建成的动态网站服务器架构。下面使用docker制作分布式lnmp 镜像。 1、docker 分布式 lnmp
你好,我创建了一个基础镜像;但是,每当我运行 docker build . 时,我都看不到成功构建 我的 docker 文件 FROM centos:7 ARG user=john ARG home=
我想要我的 iPhone 应用程序中有一个功能,可以将图像转换为类似镜像的方式。 就像如果有一个左手举起的人的图像,那么转换后的图像必须有右手举起的同一个人。 任何代码或链接将不胜感激 预先感谢您的帮
我们希望将一个Elasticsearch集群放置在kubernetes集群的顶部(当前有2个节点,但是我们计划增加它)。 是否可以通过使集群中的每个节点包含相同数据的方式配置elasticsearch
我试图了解 docker 如何在文件系统上存储图像和图层。构建图像时,图层出现在 /var/lib/docker/image/overlay2/layerdb 中,图像出现在 /var/lib/doc
所以我最近开始使用 docker,因为我认为让我的网站 dockerised 会很好。我有一个 super 简单的 docker-compose.yml 文件,其中仅包含 wordpress:late
我有一个 docker 镜像,叫它 dockerimage/test。每次我更新它时,我都会增加一个标签,所以 dockerimage/test:1、dockerimage/test:2 等等。 当我
我开始使用 Docker,我发现我可以将主图像存储库放在不同的磁盘上(符号链接(symbolic link)/var/lib/docker 到其他位置)。 但是,现在我想看看是否有办法将它拆分到多个磁
显然应用程序打包和部署似乎有两种做法 创建 Docker 镜像并部署它 从头开始构建和部署应用程序。 我对如何使用选项 1) 感到困惑。前提是你获取一个 docker 镜像并在任何平台上重复使用它。但
我有一个 UIView具有透明背景和一些按钮。我想捕获 View 的绘图,将其缩小,然后在屏幕上的其他位置重新绘制(镜像)它。 (在另一个 View 之上。)按钮可以更改,因此它不是静态的。 最好的方
我正在为一个项目编写测试,我想测试和验证一个 docker 镜像构建。但我不想推送图像。 我希望图像构建在 CI(如 taskcluster)上并运行测试。 最佳答案 您需要使用 taskcluste
我想复制每个 html 页面中的代码,同时添加一些更改: 例子: Any text (even if includes :., 输出: Any text (even if includes :.,
我使用三星 ARM Cortex A9 Exynos4412 板。我在板上启动“linux + Qt”img。但是板上没有包管理器,也没有 make 、 gcc 命令。在/bin 文件中有文件 Bus
是否有可能以某种方式设置一个 git 存储库,该存储库像通常的 --mirror 一样用于 pull 入它,但在将从推送到另一个存储库时没有强制? 最佳答案 您可以像这样添加 --no-force 来
背景 最近在巡检过程中,发现harbor存储空间使用率已经达到了80%。于是,去看了一下各项目下的镜像标签数。发现有个别项目下的镜像标签数竟然有好几百个。细问之下得知,该项目目前处于调试阶段
以下均在centos 7进行的操作 docker安装 ? 1
我知道如何删除 N 天前创建的旧 Docker 镜像。 See here 但我真正想做的是删除过去 N 天未使用的旧 Docker 镜像。 目标是保留经常使用的图像,即使在我进行清理时没有容器实际使用
我有一个自定义的 docker 镜像,已经构建好了。没有可用的 Dockerfile。在容器内部,可以使用自定义用户,而不是 root,比如 test。此用户已附加到组 test。这是容器的默认用户。
我有一个开发数据库,我想将其提交到 docker 镜像中,然后推送到私有(private)存储库并用于本地开发和 CI 构建。 数据库保存为SQL备份,我可以通过将备份文件映射到官方镜像的/doc
我是一名优秀的程序员,十分优秀!