我正在使用 docker compose 在 Ubuntu 22.04.3 上创建 Django 服务器、MySQL 数据库和 Django Q。但是当我运行 docker-compose -f ./docker-compose.yml 时,出现以下错误:
[+] Building 38.8s (1/1) FINISHED
=> ERROR [internal] booting buildkit 38.8s
=> => pulling image moby/buildkit:buildx-stable-1 20.4s
=> => creating container buildx_buildkit_default 18.5s
------
> [internal] booting buildkit:
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="using host network as the deftime="2023-10-13T13:02:28Z" level=warning msg="using host network as the default"
#0 38.84 time="2023-10-13T13:02:28Z" level=warning msg="skipping containerd worker, as \"/run/containerd/containerd.sock\" does not exist"
#0 38.84 dtime="2023-10-13T13:02:28Z" level=info msg="found 1 workers, …Run Code Online (Sandbox Code Playgroud) 我正在使用 Buildkit 来构建和推送图像。我想在 buildctl 命令中的图像上添加多个标签。例如 buildctl build --frontend=dockerfile.v0 --local context=。--本地 dockerfile=. --output=type=image,name=test/repo:tag1,test/repo:tag2,push=true
以上命令失败。请建议我如何使用 buildctl 命令用 tag1 和 tag2 标记图像并推送它
使用导出器不起作用,它报告导出器已被弃用
我想让我的主机上的文件夹在RUN声明期间可用。也就是说,类似于容器运行的效果-v:
docker run -v /path/on/host:/path/in/container mycontainer:tag
Run Code Online (Sandbox Code Playgroud)
在容器中,这为我/path/in/container提供了path/on/host.
为此,我正在尝试https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md 中的实验挂载选项:
RUN --mount=type=bind,target=/path/on/host
Run Code Online (Sandbox Code Playgroud)
这/path/on/host在RUN.
然后我有两个问题:
我可以ls在里面文件/path/on/host,但不能使用它们(例如cat它们)。我试图改变type到如cache使用source像https://devops.stackexchange.com/questions/6078/in-a-dockerfile-is-there-a-way-to-avoid-copying-files-to-make- them-accessible-t,但我无法让它工作。
我无法弄清楚如何在“RUN图像”中使用不同的路径,即,/path/in/container而不是/path/on/host.
我目前正在使用以下命令来构建带有标签的图像:
buildctl build \
--frontend dockerfile.v0 --opt filename=${DOCKER_FILE} --local dockerfile=${DOCKER_ROOT} \
${BUILD_ARGS} --local context=${DOCKER_ROOT} \
--import-cache type=registry,ref=${REGISTRY_URL}/${REGISTRY_NAMESPACE}/${IMAGE_NAME} \
--output type=image,name="${REGISTRY_URL}/${REGISTRY_NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}",push=true
Run Code Online (Sandbox Code Playgroud)
我想向同一张图像添加新标签。我已经尝试过 Buildctl 命令中建议的方法来标记多个图像,但失败了。
buildctl build \
--frontend dockerfile.v0 --opt filename=${DOCKER_FILE} --local dockerfile=${DOCKER_ROOT} \
${BUILD_ARGS} --local context=${DOCKER_ROOT} \
--import-cache type=registry,ref=${REGISTRY_URL}/${REGISTRY_NAMESPACE}/${IMAGE_NAME} \
--output type=image,name="${REGISTRY_URL}/${REGISTRY_NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG},${REGISTRY_URL}/${REGISTRY_NAMESPACE}/${IMAGE_NAME}:latest",push=true
Run Code Online (Sandbox Code Playgroud)
error: invalid value acme.com/namespace/image-name:latest
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下方法,但它只创建带有latest标签的图像,而不是两者
error: invalid value acme.com/namespace/image-name:latest
Run Code Online (Sandbox Code Playgroud)
我想要的是:
IMAGE_TAG和的值latest有谁知道该怎么做?
我对 docker 和 DevOps 还很陌生。我正在尝试将一个秘密传递给我的 Docker 容器以在构建中使用。我读到,使用 BuildKit 可以提高安全性,因为秘密不会被烘焙到容器中。按照本文底部评论中的步骤进行操作后,我遇到了问题/sf/answers/4921657751/这似乎完美地解决了我的问题,并且看起来非常直接和简单,但是我不确定出了什么问题?我可以使用 --build-arg 将其他环境传递到构建中(我没有将它们包含在 yaml 代码片段中),但这种方法似乎在 Dockerfile 阶段对我来说是破坏性的(我认为)。
我的构建管道将值存储为秘密,当我将秘密回显到文件中$(Pipeline.Workspace)/direct_line_secret.txt并对其进行分类时,如下所示,我得到了管道构建中返回的 *** 隐藏值(从底部开始第二行)。
Starting: Store direct line secret
==============================================================================
Task : Bash
Description : Run a Bash script on macOS, Linux, or Windows
Version : 3.195.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash /home/vsts/work/_temp/070f6401-2a4d-4656-b674-4fadcce142ea.sh
***
Finishing: Store direct line secret
Run Code Online (Sandbox Code Playgroud)
这是我用于创建此脚本和 docker 构建任务的 yaml 文件。
trigger:
- main
resources:
- repo: self …Run Code Online (Sandbox Code Playgroud) environment-variables docker dockerfile azure-devops docker-buildkit