Docker pull error in systemd script on CoreOS
I created a droplet with the following configuration:
512MB Ram 20GB SSD Disk Amsterdam 3 CoreOS CoreOS (beta) 494.0.0
CoreOS was subsequently updated to 494.1.0.
Since I don't need a cluster, I didn't provide a cloud-config.
Then I added the following systemd script in /etc/systemd/system/hello.service (copied from the official CoreOS tutorial):
[Unit] Description=MyApp After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 ExecStartPre=-/usr/bin/docker kill busybox1 ExecStartPre=-/usr/bin/docker rm busybox1 ExecStartPre=/usr/bin/docker pull busybox ExecStart=/usr/bin/docker run --name busybox1 busybox /bin/sh -c "while true; do echo Hello World; sleep 1; done" [Install] WantedBy=multi-user.target
I ran 'sudo systemctl enable hello' and 'sudo systemctl start hello'. Everything worked perfectly.
Then I rebooted the machine, and this happened:
systemd: Starting MyApp... docker: busybox1 docker: busybox1 docker: Pulling repository busybox docker: Get https://index.docker.io/v1/repositories/library/busybox/images: dial tcp: lookup index.docker.io: connection refused systemd: hello.service: control process exited, code=exited status=1 systemd: Failed to start MyApp. systemd: Unit hello.service entered failed state.
I destroyed and recreated the droplet, with exactly the same result.
I tried the same approach and script locally with Vagrant as well as on Google Computing Engine, and it worked as expected both times.
Am I doing something wrong, or does the problem lie with Digital Ocean?