Unable to connect to GITHUB during Docker Instance cloud-init
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:
#!/bin/sh 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.