以下是请求及其回复:
$ curl -v -X GET domain.com:5000/v2/_catalog/
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 165.227.161.233...
* TCP_NODELAY set
* Connected to domain.com (165.227.161.233) port 5000 (#0)
> GET /v2/_catalog/ HTTP/1.1
> Host: domain.com:5000
> User-Agent: curl/7.55.1
> Accept: */*
>
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
* Failed writing body (0 != 7)
* Closing connection 0
[stephane@stephane-ThinkPad-X201 ~]
$ curl -v -X GET domain.com:5000/v2/_catalog/
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 165.227.161.233...
* TCP_NODELAY set
* Connected to domain.com (165.227.161.233) port 5000 (#0)
> GET /v2/_catalog/ HTTP/1.1
> Host: domain.com:5000
> User-Agent: curl/7.55.1
> Accept: */*
>
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
* Failed writing body (0 != 7)
* Closing connection 0
以下是我在docker-compose.yml文件中创建注册表的方法:
version: "3"
services:
registry:
restart: always
image: registry:latest
container_name: registry
ports:
- 5000:5000
volumes:
- ~/dev/docker/registries/registry:/var/lib/registry
我的码头版本是:
$ docker version
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:11:14 2017
OS/Arch: linux/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:09:47 2017
OS/Arch: linux/amd64
Experimental: false
答案 0 :(得分:0)
您可以尝试使用-o
选项从服务器恢复响应的实际内容,例如:
curl –k –o body.txt -X GET domain.com:5000/v2/_catalog/
然后,更改文件.txt
的扩展名,以对应服务器提供的预期内容类型格式。
curl -i -X GET domain.com:5000/v2/_catalog/
检查:
Content-Type: image/png, application/json , etc
服务器发送的数据可能是格式错误的
答案 1 :(得分:0)
由于ssl东西,我也遇到了相同的错误,因为我的本地docker注册表受到保护,因此您必须在本地注册表url的开头提到 https:// ... >
curl --key <ssl key file> --cacert <ssl pem file> -X GET https://<your local registry url >:<your port>/v2/_catalog
或不安全:
curl -k -X GET https://<your local registry url >:<your port>/v2/_catalog