Jos*_*eph 2 linux windows ssl debian docker
我在 Windows 10 上使用 Docker 创建 Debian 映像。但是,我认为 Docker 桌面、Dockerfile 或 Docker 命令存在问题。
在Docker Desktop 中,我对默认配置进行了三处更改。
Expose daemon on tcp://localhost:2375 without TLS.http和https配置。导致问题的Dockerfile如下:
FROM debian:buster-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && \
apt-get install -y wget && \
apt-get clean
CMD [ "/bin/bash" ]
Run Code Online (Sandbox Code Playgroud)
如果有帮助,这种替代Dockerfile运行没有问题:
FROM debian:buster-slim
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && \
apt-get clean
CMD [ "/bin/bash" ]
Run Code Online (Sandbox Code Playgroud)
我用来构建Dockerfile的Docker命令如下:
>>> docker build simple-example
Run Code Online (Sandbox Code Playgroud)
注意:Dockerfile是目录中唯一的文件simple-example。
在给定Docker 桌面配置的情况下,尝试使用Docker 命令构建Dockerfile 会导致以下错误:
(base) C:\Users\usr1\Docker>docker build simple-example
[+] Building 25.4s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:buster-slim 2.9s
=> CACHED [1/2] FROM docker.io/library/debian:buster-slim@sha256:240f770008bdc538fecc8d3fa7a32a533eac55c14cbc56a9a8a6f7d741b47e33 0.0s
=> ERROR [2/2] RUN apt-get update --fix-missing && apt-get install -y wget && apt-get clean 22.4s
------
> [2/2] RUN apt-get update --fix-missing && apt-get install -y wget && apt-get clean:
#5 21.80 Err:1 http://deb.debian.org/debian buster InRelease
#5 21.80 Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused)
#5 21.80 Err:2 http://deb.debian.org/debian buster-updates InRelease
#5 21.80 Unable to connect to deb.debian.org:http:
#5 22.28 Err:3 http://security.debian.org/debian-security buster/updates InRelease
#5 22.28 Could not connect to security.debian.org:80 (151.101.0.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.64.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.128.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.192.204). - connect (111: Connection refused)
#5 22.29 Reading package lists...
#5 22.32 W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (151.101.54.132). - connect (111: Connection refused)
#5 22.32 W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Could not connect to security.debian.org:80 (151.101.0.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.64.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.128.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (151.101.192.204). - connect (111: Connection refused)
#5 22.32 W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Unable to connect to deb.debian.org:http:
#5 22.32 W: Some index files failed to download. They have been ignored, or old ones used instead.
#5 22.34 Reading package lists...
#5 22.35 Building dependency tree...
#5 22.35 Reading state information...
#5 22.35 E: Unable to locate package wget
------
executor failed running [/bin/sh -c apt-get update --fix-missing && apt-get install -y wget && apt-get clean]: exit code: 100
Run Code Online (Sandbox Code Playgroud)
这三者中的哪一个——Docker 桌面、Dockerfile 或 Docker 命令——导致了这个错误?我应该怎么做才能修复它?
jus*_*dev 12
我有这个问题。我尝试重新启动docker,重新启动计算机,升级docker桌面(我在Windows上,WSL2),清除docker缓存。什么都没起作用。
最后解决我问题的是重置路由器。我知道这听起来很愚蠢,因为互联网一直在工作,而且我什至在 WSL2 内也有网络。所以我无法解释这个修复,但它确实有效。
尝试将这两行放在您的 Dockerfile 中:
ENV http_proxy=http:...
ENV https_proxy=http:...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3881 次 |
| 最近记录: |