尝试运行docker文件时出现错误(error: Service failed to build)



我的项目有以下结构:

docker-compose.yml- docker-compose文件我创建

schemathesis-包含源代码和dockerfile的文件夹

其中docker-compose.yml为:

version: '3'
services:
schemathesis:
build: ./schemathesis
ports:
- "8180:80"    
networks:
- default

schemathesis文件夹中的Dockerfile如下:

FROM python:3.10-alpine
LABEL Name=Schemathesis
WORKDIR /app
RUN addgroup --gid 1000 -S schemathesis && 
adduser --uid 1000 -D -S schemathesis -G schemathesis -s /sbin/nologin
COPY --chown=1000:1000 pyproject.toml README.rst src ./
RUN apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev && 
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && 
source $HOME/.cargo/env && 
pip install --upgrade pip && pip install --no-cache-dir ./ && 
apk del .build-deps && 
rustup self uninstall -y
# Needed for the `.hypothesis` directory
RUN chown -R 1000:1000 /app
USER schemathesis
ENTRYPOINT ["schemathesis"]

当我运行:sudo docker-compose up --build我得到一个错误错误:Service 'schemathesis' failed to build:

Building schemathesis
Step 1/9 : FROM python:3.10-alpine
---> 8a3a8409a638
Step 2/9 : LABEL Name=Schemathesis
---> Using cache
---> f108325765ba
Step 3/9 : WORKDIR /app
---> Using cache
---> 9fc24fc24456
Step 4/9 : RUN addgroup --gid 1000 -S schemathesis &&     adduser --uid 1000 -D -S schemathesis -G schemathesis -s /sbin/nologin
---> Using cache
---> 64881e35ad07
Step 5/9 : COPY --chown=1000:1000 pyproject.toml README.rst src ./
---> Using cache
---> 8b9dfeb0ed09
Step 6/9 : RUN apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev &&     curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y &&     source $HOME/.cargo/env &&     pip install --upgrade pip && pip install --no-cache-dir ./ &&     apk del .build-deps &&     rustup self uninstall -y
---> Running in fafc492c1f99
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/main: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/community: temporary error (try again later)
ERROR: unable to select packages:
.build-deps-20230120.185651:
masked in: cache
satisfies: world[.build-deps=20230120.185651]
build-base (no such package):
required by: .build-deps-20230120.185651[build-base]
libffi-dev (no such package):
required by: .build-deps-20230120.185651[libffi-dev]
curl (no such package):
required by: .build-deps-20230120.185651[curl]
openssl-dev (no such package):
required by: .build-deps-20230120.185651[openssl-dev]
ERROR: Service 'schemathesis' failed to build: The command '/bin/sh -c apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev &&     curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y &&     source $HOME/.cargo/env &&     pip install --upgrade pip && pip install --no-cache-dir ./ &&     apk del .build-deps &&     rustup self uninstall -y' returned a non-zero code: 5

任何帮助都将是非常感激的。

不知道是什么问题,但下面的一组命令解决了它:

sudo service firewalld stop
sudo service docker restart
sudo systemctl daemon-reload; systemctl restart docker

相关内容

  • 没有找到相关文章

最新更新