想直接使用docker的kotti镜像,kotti是一个基于pyramid的web框架。结果docker search查找的时候报错,不管是docker search kotti 还是docker search register.liberx.info/busybox ,都有报错:
E:\github\kotti>docker search register.liberx.info/busybox
Error response from daemon: Unexpected status code 521
E:\github\kotti>docker search kotti
Error response from daemon: Get "https://index.docker.io/v1/search?q=kotti&n=25": dialing index.docker.io:443 container via direct connection because has no HTTPS proxy: connecting to index.docker.io:443: dial tcp [2a03:2880:f10f:83:face:b00c:0:25de]:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
不明白怎么回事,docker咋又出问题了?
使用docker info查看,输出:
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
看了下,docker info这个报错信息应该不用管。
Windows下,Docker Desktop的配置文件在:C:\Users\<你的用户名>\.docker\config.json
C:\Users\admin\.docker\config.json
好像没啥问题
镜像配置文件:C:\Users\Admin\.docker\daemon.json
配置好像也没问题
{
"registry-mirrors": [
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"
]
}
问题是配置了daemon.json ,怎么还会连到https://index.docker.io/v1/search?q=kotti&n=25 呢?
镜像名称问题:如果你在拉取镜像时没有指定镜像加速器上的镜像仓库名称,而是直接使用了 Docker Hub 上的镜像名称(例如 docker pull ubuntu
),那么 Docker Daemon 会默认从 Docker Hub 上拉取镜像。为了从镜像加速器上拉取镜像,你可能需要指定镜像加速器上的镜像仓库名称(例如 docker pull <镜像加速器仓库>/ubuntu
),但这取决于镜像加速器的配置和是否支持这种用法。
明白是明白了,但是还是不行啊
用了科学上网,先暂时解决问题。
[DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/kotti/kotti:latest to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/
这个提示信息表明你正在拉取的镜像 docker.io/kotti/kotti:latest
使用的是一个较旧的 Docker 镜像格式 (Docker Image Format v1 或 Docker Image manifest version 2, schema 1)。 Docker 计划在未来的版本中移除对这种旧格式的支持。
看来格式老了,默认不支持。就不去修改配置让它支持了,
先换另一个镜像试试:
docker search kotti
NAME DESCRIPTION STARS OFFICIAL
kotti/kotti Pythonic web application framework based on … 1
cd45/kotti Kotti CMS, based on Python/Pyramid. Vanilla … 0
kotteeshwariila/kotti 0
第一个kotti/kotti不行,第二个cd45/kotti可以下载并启动.
启动后进入系统
>docker exec -it c870ceaa616b bash
appuser@c870ceaa616b:/app$ uname -a
Linux c870ceaa616b 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 GNU/Linux
可惜啥也看不见啊,ifconfig和ipconfig都没有,ping也没有。
在Docker Desktop里看到kotti镜像的配置:
"Cmd": [
"pserve",
"-v",
"app.ini"
],
"Image": "cd45/kotti",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "2587cf22f496d71e07505d3a570fba2d3c54591c11f346297e4d335fb242ed19",
"SandboxKey": "/var/run/docker/netns/2587cf22f496",
"Ports": {
"5000/tcp": null
},
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "8d897024120d34813097cc2c045fba569dba873de52d181d3aa890428e6faf5b",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "72:b6:52:61:44:ac",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"MacAddress": "72:b6:52:61:44:ac",
"DriverOpts": null,
"GwPriority": 0,
"NetworkID": "65a0d805224e9a9e932f53e4e25d27cda0904fd737ac5b0701cabf6fdeb26c6b",
"EndpointID": "8d897024120d34813097cc2c045fba569dba873de52d181d3aa890428e6faf5b",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"DNSNames": null
}
}
}
}
但是172.17.0.2无法ping通
172.17.0.2:5000也无法浏览....
从网上下载使用的docker镜像kotti/kotti ,
启动后,从本机无法联通它的5000端口,看配置,这个5000端口的服务是已经启动的。
看docker虚拟机的配置文件,主机是172.17.0.1 ,docker虚拟机是172.17.0.2 。
但是主机没有找到172.17.0.1这个地址或网段
到Docker Desktop里,发现虚拟机网段是192.168.56.0/24 ,怪不得不通呢。
不想改变主机的虚拟机网段配置,于是尝试打开了设置:
Enable host networking
还是不行,毕竟不在同一网段啊。
尝试浏览文件,并修改文件/etc/hosts文件
这个文件的原内容:
172.17.0.2 e29209ee8a75
先试试修改:/etc/resolv.conf
尝试添加一句内容
但是报错:
Failed to save /etc/resolv.conf: (HTTP code 500) server error - unlinkat /etc/resolv.conf: device or resource busy
不知道该咋办这样修改/etc/hosts文件的尝试宣告失败。
就先到这里吧,回头再处理。
docker又出现连通问题了,暂时只好用科学上网解决。