如何从docker hub部署到openshift?

如何从docker hub部署到openshift?,docker,openshift,dockerhub,Docker,Openshift,Dockerhub,我正在尝试从openshift上的docker hub部署docker映像 我用一个简单的spring boot rest应用程序包装了一个映像: 在登录到openshift之后,我选择了正确的项目 oc new-app ernst1970/my-rest 我得到 W0509 13:17:28.781435 16244 dockerimagelookup.go:220] Docker registry lookup failed: Get https://registry-1.docke

我正在尝试从openshift上的docker hub部署docker映像

我用一个简单的spring boot rest应用程序包装了一个映像:

在登录到openshift之后,我选择了正确的项目

oc new-app ernst1970/my-rest
我得到

W0509 13:17:28.781435   16244 dockerimagelookup.go:220] Docker registry lookup failed: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Clien
t.Timeout exceeded while awaiting headers)                                                                                                                                                 
error: Errors occurred while determining argument types:                                                                                                                                   

ernst1970/my-rest as a local directory pointing to a Git repository:  GetFileAttributesEx ernst1970/my-rest: The system cannot find the path specified.                                    

Errors occurred during resource creation:                                                                                                                                                  
error: no match for "ernst1970/my-rest"                                                                                                                                                    

The 'oc new-app' command will match arguments to the following types:                                                                                                                      

  1. Images tagged into image streams in the current project or the 'openshift' project                                                                                                    
     - if you don't specify a tag, we'll add ':latest'                                                                                                                                     
  2. Images in the Docker Hub, on remote registries, or on the local Docker engine                                                                                                         
  3. Templates in the current project or the 'openshift' project                                                                                                                           
  4. Git repository URLs or local paths that point to Git repositories                                                                                                                     

--allow-missing-images can be used to point to an image that does not exist yet.                                                                                                           

See 'oc new-app -h' for examples.                                                                                                                                                          
我也试过了

oc new-app mariadb
但是得到了同样的错误信息

我想这可能是代理问题。因此,我将代理添加到我的.profile中:

不幸的是,这并没有改变任何事情


你知道这为什么不起作用吗?

你的docker守护进程需要代理,这样它才能到达DockerHub。通过将代理服务器作为docker守护程序的环境变量提供,可以指定代理服务器

查看Docker的官方文档:

添加一个文件/etc/systemd/system/docker.service.d/http-proxy.conf,该文件应包含以下内容

[Service]    
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
重新加载更改并重新启动docker守护进程

sudo systemctl daemon-reload
sudo systemctl restart docker

通过做一个简单的docker pull来验证

如果我没弄错的话,我必须在openshift服务器上执行此操作?很遗憾,除了openshift Web UI或openshift客户端之外,我没有任何权限访问此计算机。很遗憾,oc new app不接受任何代理设置。需要在新应用程序实际运行的环境中设置代理设置。也许您可以将图像推送到OpenShift可用的某个注册表,即内部注册表。
[Service]    
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
sudo systemctl daemon-reload
sudo systemctl restart docker