py
(repoexe) tzg@root:~/project/efficiency-code/RepoExec/execution-code-eval$ docker build -t codeeval-runner -f Dockerfile --platform linux/amd64 .
[+] Building 30.2s (2/2) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 3.19kB 0.0s
=> WARN: MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 15) 0.0s
=> ERROR [internal] load metadata for docker.io/library/python:3.10.2-slim-bullseye 30.2s
------
> [internal] load metadata for docker.io/library/python:3.10.2-slim-bullseye:
------
1 warning found (use docker --debug to expand):
- MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 15)
Dockerfile:37
--------------------
35 |
36 | # Execution stage for Pynguin
37 | >>> FROM python:3.10.2-slim-bullseye AS execute
38 |
39 | # Set environment variables
--------------------
ERROR: failed to solve: python:3.10.2-slim-bullseye: failed to resolve source metadata for docker.io/library/python:3.10.2-slim-bullseye: failed to do request: Head "https://mirror.ccs.tencentyun.com/v2/library/python/manifests/3.10.2-slim-bullseye?ns=docker.io": dial tcp: lookup mirror.ccs.tencentyun.com on 127.0.0.53:53: no such host
错误诊断
- 报错信息:
lookup mirror.ccs.tencentyun.com ... no such host - 含义: 你现在的配置文件里填的是腾讯云的镜像源,但这个地址通常只能在腾讯云的服务器(内网)里访问,外网访问不通,或者已经失效了。
现在的状况是:你一直在尝试各种国内镜像源,但它们最近非常不稳定,导致你一直卡在"找不到网站"这一步。
解决方法 A:使用目前存活率最高的镜像源配置
请再次修改 /etc/docker/daemon.json,把里面的内容全部替换为下面这组目前公认比较坚挺的第三方代理源。
- 编辑文件:
bash
sudo vim /etc/docker/daemon.json
- 清空原内容,填入以下内容:
json
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://huecker.io",
"https://dockerhub.timeweb.cloud",
"https://noohub.ru"
]
}
- 保存退出 (
:wq)。 - 重启服务(关键):
bash
sudo systemctl restart docker
- 再次尝试构建:
bash
docker build -t codeeval-runner -f Dockerfile --platform linux/amd64 .
解决方法 B:手动导入(一劳永逸,不再受网络气)
如果你试了上面的配置还是报错(比如报 i/o timeout 或者又是 no such host),说明你那里的网络环境把这些代理也都封了。
请不要再纠结配置文件了,直接用你的本地电脑(笔记本)帮服务器下载!
这是绝对能成功的路径:
- 在你的笔记本上(或者任何能科学上网的电脑上):
bash
# 1. 下载基础镜像
docker pull --platform linux/amd64 python:3.10.2-slim-bullseye
# 2. 把镜像存成一个文件
docker save -o python_base.tar python:3.10.2-slim-bullseye
# 3. 把文件传到服务器 (替换 IP)
scp python_base.tar tzg@zkyd:~/project/efficiency-code/RepoExec/execution-code-eval/
- 回到服务器(zkyd)上:
bash
# 4. 加载这个文件
docker load -i python_base.tar
# 5. 再次构建 (这时候 Docker 会直接发现镜像已存在,不再联网下载)
docker build -t codeeval-runner -f Dockerfile --platform linux/amd64 .
建议: 先试一下 方法 A ,如果 1 分钟内还不行,果断转 方法 B。