1

我正在尝试在 Ubuntu 14.04.1 上从源代码(而不是容器)构建一个 docker-registry 服务器。使用 digitalocean 上的说明,我能够大部分时间到达那里。

我可以毫无问题地卷曲http ://localhost:5000https://user:password@localhost:8000

当我尝试打开网络浏览器希望看到的不仅仅是这些时,问题似乎就发生了。

这是我在 /etc/nginx/sites-available/ 中的 docker-registry 文件:

# For versions of Nginx > 1.3.9 that include chunked transfer encoding support
# Replace with appropriate values where necessary
upstream docker-registry {
server 192.168.x.x:5000;
}
server {
listen 8000;
server_name docker-registry;
ssl on;
ssl_certificate /etc/nginx/ssl/docker-registry.crt;
ssl_certificate_key /etc/nginx/ssl/docker-registry.key;
proxy_set_header Host       $http_host;   # required for Docker client sake
X-Real-IP  $remote_addr; # pass on real client IP
client_max_body_size 0; # disable any limits to avoid HTTP 413 for large image uploads
# required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
chunked_transfer_encoding on;
location / {
 # let Nginx know about our auth file
 auth_basic              "Restricted";
 auth_basic_user_file    docker-registry.htpasswd;
proxy_pass http://docker-registry;
 }
location /_ping {
 auth_basic off;
 proxy_pass http://docker-registry;
}
location /v1/_ping {
 auth_basic off;
 proxy_pass http://docker-registry;
 }
}

我将我的 docker 注册表本地存储在 /var/docker-registry 中,并确保 www-data 用户可以读取它。为什么我在网络浏览器上看不到我的图像?

如果我标记图像并将其推送到我的存储库它可以工作,我可以在 Web 浏览器中看到它:

https://192.168.x.x:8000/v1/repositories/ubuntu-test/tags/latest

我看到以下内容:

 "5ba9dab47459d81c0037ca3836a368a4f8ce5050505ce89720e1fb8839ea048a"

当我尝试到达:

https://192.168.x.x:8000/v1

或者:

 https://192.168.x.x:8000/v1/repositories

或者:

 https://192.168.x.x:8000/v1/images

我收到“未找到”错误

我如何能够通过 Web 界面查看我的 /var/docker-registry 文件夹中的所有内容(这是存储这些内容的地方......是的,它们归 www-data 用户所有)?

4

1 回答 1

0

这是设计使然。不仅没有理由实现整个 url 路径,而且实现它也存在严重的安全隐患。

我假设你没有太多的网络编程经验。没有目录 '/v1/repositories'... 等等。相反,有一个程序(在这种情况下是 Python 或 Ruby)正在侦听 url 路径并具有内置逻辑来确定要做什么。

即如果 url = /v1/_ping: return 'ok'

于 2015-11-24T17:42:23.303 回答