简体   繁体   English

Bluemix Docker Container cf ic ic无法登录本地Docker守护程序以进行认证

[英]Bluemix Docker Container cf ic login the local Docker daemon is not reachable to authenticate

I am running through the directions to work with docker containers and Bluemix using the ic plugin. 我正在按照说明使用ic插件处理docker容器和Bluemix。 When I run the command: 当我运行命令时:

cf ic login

I receive the message: 我收到消息:

Your system was authenticated with the IBM Containers API, however the local Docker daemon is not reachable to authenticate it with the IBM Containers registry. 您的系统已通过IBM Containers API进行了身份验证,但是无法通过本地本地Docker守护程序通过IBM Containers注册表进行身份验证。 You can still run IBM Containers on the cloud but will not be able to push or pull images. 您仍然可以在云上运行IBM容器,但是不能推送或拉取映像。

If I work with docker locally without running the cf ic login, all seems to be fine. 如果我在本地运行docker而不运行cf ic登录,一切似乎都很好。

Following the cf ic login, if I run any docker commands such as: 在cf ic登录后,如果我运行任何docker命令,例如:

docker tag ibmjstart/bluemix-wordpress registry.ng.bluemix.net/myNamespace/wordpress

the commands fail with the message: 命令失败,并显示以下消息:

Error response from daemon: 405 Method Not Allowed 来自守护程序的错误响应:405方法不允许

Method Not Allowed 不允许的方法

The method is not allowed for the requested URL. 所请求的URL不允许使用该方法。

Any guidance on things to check is greatly appreciated. 任何检查事项的指导都将不胜感激。 Thanks! 谢谢!

The answer that V.Bontempi provided was extremely helpful and it may just have been me not quite grasping what he was stating, but to clarify it was actually setting the env variables to point exclusively to Bluemix which was causing the issue. V.Bontempi提供的答案非常有帮助,可能只是我不太了解他在说什么,而是为了澄清它实际上是将env变量设置为专门指向导致问题的Bluemix When you set the env variables 设置环境变量时

export DOCKER_HOST=tcp://containers-api.ng.bluemix.net:8443
export DOCKER_CERT_PATH=/Users/jeff/.ice/certs/containers-api.ng.bluemix.net
export DOCKER_TLS_VERIFY=1

This tells docker to work exclusively with Bluemix versus the local instance. 这告诉docker仅将Bluemix与本地实例一起使用。 So, if I set the env variables, after doing this when I attempted to work with a local image and tag it as per the tutorial found here: 因此,如果我设置了env变量,那么在尝试使用本地图像并按照此处找到的教程对其进行标记后,请执行以下操作:

WordPress on Bluemix Containers Bluemix容器上的WordPress

and I tried running the command: 我尝试运行命令:

docker tag ibmjstart/bluemix-wordpress registry.ng.bluemix.net/[namespace]/wordpress

using my namespace, the command would fail with a 405 error. 使用我的名称空间,该命令将失败并出现405错误。 On the other hand, if I run the following sequence of commands without the export , everything works as expected: 另一方面,如果我在不执行export的情况下运行以下命令序列,那么一切都会按预期进行:

cf login
cf ic login [-a https://api.ng.bluemix.net] [-H https://containers-api.ng.bluemix.net/v2/containers] [-R registry.ng.bluemix.net]
docker tag ibmjstart/bluemix-wordpress registry.ng.bluemix.net/myNamespace/wordpress
docker push registry.ng.bluemix.net/[namespace]/wordpress

The support team provided me with the following explanation: 支持团队向我提供了以下解释:

1) Install and configure docker to work locally This is the first think you need to do, so you can create your images locally before pushing to IBM Containers in Bluemix. 1)安装和配置docker以在本地工作这是您首先需要做的,因此您可以在推送到Bluemix中的IBM Containers之前在本地创建映像。 For this step to work you have to configure docker environment variables. 为了执行此步骤,您必须配置docker环境变量。 To do this you can run the following command: eval "$(docker-machine env default)" 为此,您可以运行以下命令:eval“ $(docker-machine env default)”

This will set the environment variables for you local docker. 这将为您的本地docker设置环境变量。 Docker will not work if you not set this variables. 如果不设置此变量,Docker将无法工作。 After setting this you can try basic docker commands, like: 设置此选项后,您可以尝试使用基本的docker命令,例如:

      docker images
      docker ps

You will notice that these commands would not work if you have not set the environment variables. 您将注意到,如果未设置环境变量,这些命令将不起作用。

2) Log in to Bluemix and IBM Containers Now that docker is installed and configured you can log in with the following commands: 2)登录到Bluemix和IBM Containers现在已经安装并配置了docker,您可以使用以下命令登录:

       cf login 
       cf ic login 

After that you can start playing with your images and pushing them to IBM Containers in Bluemix once they are ready.

Thanks to the Bluemix support team for the help! 感谢Bluemix支持团队的帮助!

this is because cf ic output is suggesting you that you have to switch docker from your local engine to Bluemix one before using docker client to work remotely. 这是因为cf ic输出建议您在使用docker客户端进行远程工作之前,必须将docker从本地引擎切换到Bluemix。 As suggested from the output of cf ic login, you simply have to set the following env vars to remote Bluemix references, exactly as suggested DOCKER_TLS_VERIFY DOCKER_HOST DOCKER_CERT_PATH 正如cf ic login的输出所建议的那样,您只需要将以下env vars设置为远程Bluemix引用,就完全像建议的那样DOCKER_TLS_VERIFY DOCKER_HOST DOCKER_CERT_PATH

Then if you wish to switch back simply set value to their previous values (eventually print them and save before switching) 然后,如果您想切换回去,只需将其设置为以前的值即可(最终将它们打印并保存,然后再进行切换)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM