docker - 运行命令时Dockerfile中的错误-> docker logs test-client

标签 docker dockerfile

有人可以告诉我以下Dockerfile中的错误:
我正在尝试遵循此仓库中给出的说明:
https://github.com/anthcourtney/docker-consul-template-haproxy

FROM alpine:3.4


RUN apk --update add python py-pip && \
    pip install pytest requests 
ADD test_http.py /tmp

CMD ["pytest", "/tmp"]

完整的日志为:
Building test
Step 1/4 : FROM alpine:3.4
 ---> b7c5ffe56db7
Step 2/4 : RUN apk --update add python py-pip &&     pip install pytest requests
 ---> Running in b3f06fa34b2e
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/12) Installing libbz2 (1.0.6-r5)
(2/12) Installing expat (2.2.0-r1)
(3/12) Installing libffi (3.2.1-r2)
(4/12) Installing gdbm (1.11-r1)
(5/12) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(6/12) Installing ncurses-terminfo (6.0_p20171125-r0)
(7/12) Installing ncurses-libs (6.0_p20171125-r0)
(8/12) Installing readline (6.3.008-r4)
(9/12) Installing sqlite-libs (3.13.0-r2)
(10/12) Installing python (2.7.14-r0)
ERROR: python-2.7.14-r0: BAD archive            /***signature also in place of archive***/
(11/12) Installing py-setuptools (20.8.0-r0)
(12/12) Installing py-pip (8.1.2-r0)
Executing busybox-1.24.2-r14.trigger
1 errors; 23 MiB in 22 packages
ERROR: Service 'test' failed to build: The command '/bin/sh -c apk --update add python py-pip &&     pip install pytest requests' returned a non-zero code: 1

有什么解决办法吗?

最佳答案

这里的问题是 Alpine 图像版本,请使用最新标记或与最新py-pip兼容的任何其他标记进行尝试。

FROM alpine:latest

RUN apk --update add python py-pip && \
    pip install pytest requests 
ADD test_http.py /tmp

CMD ["pytest", "/tmp"]

您也可以找到并尝试安装与alpine 3.4版本兼容的py-pip版本。

关于docker - 运行命令时Dockerfile中的错误-> docker logs test-client,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59990044/

相关文章:

docker - 为什么客户端无法连接到localhost :8080?

node.js - Nginx 与 dockerized NodeJS

docker - 构建镜像时,Docker for Windows退出,代码为127

docker - 在构建期间将参数传递给通过Dockerfile运行的脚本

maven - 如何在 Docker 容器中自动重建 Java Webapp

docker - 无效的绑定(bind)地址格式 : Connect to remote DOCKER_HOST via ssh from docker in docker

ubuntu - 使用 shell 脚本在 docker 容器内挂载 NFS 共享

mongodb - 开发:Express和Mongo Docker容器网络

docker - 使用 Dockerfile 中的 COPY 在目标目录中复制具有不同名称的文件

docker - 使用 Docker chown 容器目录 (ubuntu - mysql/mysql-server)