Unable to connect to GITHUB during Docker Instance cloud-init

February 28, 2015 3k views

x-post comment from:
An Introduction to Droplet Metadata

I’m using the cloud-init to initialize my docker instance. However, I’m finding that I can’t seem to make a network connection to github.com during init.

My script is:


git clone https://github.com/pkimbrel/centos-node-hello.git

cd centos-node-hello

docker build -t centos-node-hello .
docker run -p 80:8080 -d centos-node-hello

During start up, the logs shows:

fatal: unable to access 'https://github.com/pkimbrel/centos-node-hello.git/': Failed to connect to github.com port 443: Connection timed out

Of course, after that everything fails since I didn’t get the code.

Now, if I let the droplet finish it’s startup sequence and log in, I can re-run the script manually and the git clone works just fine. The docker image gets created and starts and my app is running.

It almost appears that the network hasn’t fully set up when the cloud-init executes.

1 Answer

I attempted twice to replicate this issue but using your cloud-init script exactly as you pasted it on a newly created droplet based on our docker image completed without any issue on both attempts. It is possible that a temporary network issue caused the problem that you saw but your script, as pasted appears to work perfectly.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!