gpt4 book ai didi

ubuntu - Docker Compose 无法使用 Podman 构建

转载 作者:行者123 更新时间:2023-12-04 19:29:00 40 4
gpt4 key购买 nike

如果我为服务拉取图像,Docker compose 将与 podman 一起使用,但在我尝试构建图像时将无法使用。
Dockerfile

FROM docker.io/hello-world


$ docker build --tag uscm5 .
STEP 1: FROM docker.io/hello-world
STEP 2: COMMIT uscm5
--> d1165f22123
Successfully tagged localhost/uscm5:latest
Successfully tagged docker.io/library/hello-world:latest
d1165f2212346b2bab48cb01c1e39ee8ad1be46b87873d9ca7a4e434980a7726
docker-compose.yml
使用图像配置而不是构建,它工作得很好。
services:
web:
build: .
# image: docker.io/hello-world


$ docker-compose up
Building web
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 203, in perform_command
File "compose/metrics/decorator.py", line 18, in wrapper
File "compose/cli/main.py", line 1186, in up
File "compose/cli/main.py", line 1182, in up
File "compose/project.py", line 664, in up
File "compose/service.py", line 364, in ensure_image_exists
File "compose/service.py", line 1133, in build
File "compose/service.py", line 1943, in build
File "subprocess.py", line 800, in __init__
File "subprocess.py", line 1551, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'docker': 'docker'
[579202] Failed to execute script docker-compose
我的环境和程序版本似乎正确:
$ docker-compose -v && podman -v && lsb_release -r
docker-compose version 1.29.2, build 5becea4c
podman version 3.2.3
Release: 21.04

$ printenv | grep -e DOCKER -e COMPOSE
DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
我错过了什么?

最佳答案

设置COMPOSE_DOCKER_CLI_BUILD=0就是它所在的位置 - 谢谢@Luap99 在 GitHub。 https://github.com/containers/podman/issues/11052
Docker Compose 使用 Docker CLI 而不是 DOCKER_HOST 处的套接字。如果我有 alias docker=podman,也许我不会注意到但与 COMPOSE_DOCKER_CLI_BUILD=0将使用 docker 客户端而不是 CLI。

关于ubuntu - Docker Compose 无法使用 Podman 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68507359/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com