Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DockerDaemonConnectionError when setting Google Cloud Managed VM in Ubuntu

I'm trying to install Google Cloud Managed VM in Ubuntu according to this manuals: [1], [2]

I've installed Docker following the Docker installation guide.

Running Docker with: sudo docker -H tcp://127.0.0.1:2376 -d

I've created certificate keys according to the HTTPS Docker guide.

My environments variables:

  • DOCKER_HOST=tcp://:2376
  • DOCKER_TLS_VERIFY=1
  • DOCKER_CERT_PATH=/home/eyalev/ca

When I run gcloud preview app setup-managed-vms

I get an error:

https://gist.github.com/eyalev/aab86463bc63f4319d5c

Traceback (most recent call last):
File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
 line 153, in <module> main()   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
 line 149, in main _cli.Execute()   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py",
 line 381, in Execute post_run_hooks=self.__post_run_hooks, kwargs=kwargs)   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py",
 line 274, in _Execute pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py",
 line 887, in Run result = command_instance.Run(args)   File "/home/eyalev/Software/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/setup_managed_vms.py",
 line 37, in Run setup_registry.SetupRegistry()   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/setup_registry.py",
 line 32, in SetupRegistry timeout=config.DOCKER_D_REQUEST_TIMEOUT)   File "/home/eyalev/Software/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py",
 line 663, in NewDockerClient 'Couldn\'t connect to the docker daemon using the specified ' google.appengine.tools.docker.containers.DockerDaemonConnectionError:

Couldn't connect to the docker daemon using the specified environment
variables. Please check the environment variables DOCKER_HOST,
DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are set correctly. If you are
using boot2docker, make sure you have run "$(boot2docker shellinit)"

Is there something I'm missing?

like image 253
Eyal Levin Avatar asked Nov 10 '14 11:11

Eyal Levin


People also ask

How do I create an instance of Google Cloud in Ubuntu?

In the Google Cloud console, go to the Create an instance page. In the Boot disk section, click Change to begin configuring your boot disk. On the Public images tab, choose Ubuntu from the Operating system list. Choose Ubuntu 20.04 LTS from the Version list.

How do I access GCP VM from terminal?

Select Metadata under Settings. Once the page opens click on EDIT and then select ADD ITEM and enter the value. Then click on SAVE. Now go to your Local machine and in terminal use the ssh command along with your private SSH key file, the username, and the external IP address of the instance to connect.

How do I enable SSH in GCP instance?

Connect through a browser from the GCP MarketplaceBrowse to the Google Cloud Platform console and sign in if required using your Google account. Find and select your project in the project list. Select the “Compute -> Compute Engine” menu item. Locate your server instance and select the SSH button.


1 Answers

I finally got gcloud preview app setup-managed-vms to work on ubuntu. Here's what I had to do:

  1. get docker 1.3.0, not 1.3.1. sudo apt-get install docker.io installed and old version of docker on my machine, so I had to remove that first. But curl -sSL https://get.docker.com/ubuntu/ | sudo sh installs version 1.3.1, which also doesn't work. I replayed every line in the script at https://get.docker.com/ubuntu/ but I had to change the last line apt-get install -y lxc-docker to apt-get install -y lxc-docker-1.3.0 The official docs mention that app engine doesn't work with boot2docker 1.3.1, but I think they meant that it doesn't work with docker 1.3.1.

  2. I couldn't get 127.0.0.1 to work as my host name. I had to use localhost when creating the ca and server certificates.

  3. I had to export DOCKER_HOST=tcp://localhost:2376 (note the use of localhost) along with DOCKER_TLS_VERIFY=1 and DOCKER_CERT_PATH=<path>

  4. I set DOCKER_OPTS in /etc/default/docker to "--tlsverify --tlscacert=<path>/ca.pem --tlscert=<path>/server-cert.pem --tlskey=<path>/server-key.pem -H=0.0.0.0:2376"

gcloud preview app setup-managed-vms works now, but I haven't gotten gcloud preview app run for my go app to work yet.

like image 194
Dallan Quass Avatar answered Sep 25 '22 11:09

Dallan Quass