我正在尝试使用以下配置创建rest-api实例: rest-api.json
{
"rest-api": {
"name": "restdb-api",
"database": "restdb",
"port": "8003",
"xdbc-enabled": true,
"forests-per-host": 1,
"error-format": "json"
}
}
curl --anyauth --user admin:admin -i -X POST -d @"./REST/rest-api.json" -H "Content-type: application/json" http://localhost:8002/LATEST/rest-apis
端点返回201 created,但我无法访问http://localhost:8003上创建的端点。我已经尝试使用其他端口,但同样的事情正在发生。端口8003未在侦听。请帮我解决这个问题。
HTTP/1.1 401 Unauthorized
Server: MarkLogic
WWW-Authenticate: Digest realm="public", qop="auth", nonce="36473d01f5e45a:ND9/6NHD0sw9o2y/xad/uQ==", opaque="e9594a1b7e019a97"
Content-Type: text/html; charset=utf-8
Content-Length: 209
Connection: Keep-Alive
Keep-Alive: timeout=5
HTTP/1.1 201 Created
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
发布于 2018-06-01 12:52:45
因为您说您正在本地docker容器上运行,所以您可能需要发布端口。
请参阅Docker Expose
请从链接中注意-“EXPOSE指令并不实际发布端口。它用作构建镜像的人和运行容器的人之间的一种文档类型,关于打算发布哪些端口。要在运行容器时实际发布端口,请在docker run上使用-p标志来发布和映射一个或多个端口,或者使用-P标志来发布所有暴露的端口并将其映射到高阶端口。”
希望这能有所帮助!
https://stackoverflow.com/questions/50632344
复制相似问题