[英]Cannot get a valid response from Docker Registry remote API
I'm using Nodejs & request to form my API calls, I can make API calls directly to a UnixSocket with it however it fails every attempt when requesting from the Docker registry container I have running, so I believe it's the fault of my registry configuration. 我正在使用Nodejs& request来形成我的API调用,我可以使用它直接向UnixSocket进行API调用,但是从运行的Docker注册表容器中进行请求时,它每次尝试都会失败,所以我认为这是我的注册表配置的错误。
I've set it up out of the box just like the doc steps below. 我已经按照以下文档步骤对它进行了设置。
docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker pull alpine
docker tag alpine localhost:5000/alpine
docker push localhost:5000/alpine
The code I'm using to request is below, it receives a 404 not found
. 我要请求的代码如下,它收到
404 not found
。
const request = require('request')
request({
method: 'GET',
uri: 'http://localhost:5000/images/json', // status 404
// uri: 'http://unix:/var/run/docker.sock:/images/json', // this works
headers: { host : 'localhost' }
}, (e, res, body) => {
if(e) return console.error(e)
console.log(res.statusCode == 200 ? JSON.parse(body) : res.statusCode)
})
To be clear, this code is just to demonstrate that I'm making a GET request that should be well-formed. 需要明确的是,这段代码只是为了证明我正在发出一个格式正确的GET请求。
What has to be done to allow a running registry container respond to the remote API? 为了使正在运行的注册表容器能够响应远程API,必须做什么?
Docker Registry doesn't have the /images/json
API, and the Docker Registry's API does not compatible with docker engine API. Docker Registry不具有
/images/json
API,并且Docker Registry的API与docker engine API不兼容。
To get the image list of Docker Registry, please try GET /v2/_catalog
. 要获取Docker Registry的映像列表,请尝试
GET /v2/_catalog
。 Full document can be found here . 完整的文档可以在这里找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.