Bluemix Docker Container cf ic login the local Doc

2019-08-07 02:15发布

I am running through the directions to work with docker containers and Bluemix using the ic plugin. 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. You can still run IBM Containers on the cloud but will not be able to push or pull images.

If I work with docker locally without running the cf ic login, all seems to be fine.

Following the cf ic login, if I run any docker commands such as:

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

Method Not Allowed

The method is not allowed for the requested URL.

Any guidance on things to check is greatly appreciated. Thanks!

2条回答
够拽才男人
2楼-- · 2019-08-07 02:57

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. 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

Then if you wish to switch back simply set value to their previous values (eventually print them and save before switching)

查看更多
该账号已被封号
3楼-- · 2019-08-07 03:00

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. 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. 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:

WordPress on Bluemix Containers

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. On the other hand, if I run the following sequence of commands without the export, everything works as expected:

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. For this step to work you have to configure docker environment variables. To do this you can run the following command: eval "$(docker-machine env default)"

This will set the environment variables for you local docker. Docker will not work if you not set this variables. After setting this you can try basic docker commands, like:

      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:

       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!

查看更多
登录 后发表回答