By Paul Kimbrel
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.