问题原文
原帖链接 · Christian Grabowski · CC BY-SA 3.0
I'm using CoreOS with cloud-init and I'm trying to curl for flannel. I have a unit file as such:
[Unit]
Description=Run flannel
Documentation=https://github.com/coreos/flannel
Requires=etcd2.service
After=etcd2.service
[Service]
ExecStartPre=/usr/bin/curl -L -o /opt/bin/flannel-0.5.1-linux-amd64.tar.gz -z /opt/bin/flannel-0.5.1-linux-amd64.tar.gz https://github.com/coreos/flannel/releases/download/v0.5.1/flannel-0.5.1-linux-amd64.tar.gz
ExecStartPre=/usr/bin/tar -C /opt/bin -xzvf /opt/bin/flannel-0.5.1-linux-amd64.tar.gz
ExecStartPre=/usr/bin/mv /opt/bin/flannel-0.5.1/flanneld /opt/bin/flanneld
ExecStartPre=/usr/bin/rm -rf /opt/bin/flannel-0.5.1
ExecStartPre=/usr/bin/rm -rf /opt/bin/flannel-0.5.1-linux-amd64.tar.gz
ExecStart=/opt/bin/flanneld
when it goes to curl for flannel, I get cannot resolve host 'github.com' and curl exits with a code of 1. Is there some issue where I cannot use dns at the time systemd starts this up?
已采纳解答
原帖链接 · sysadmin1138 · CC BY-SA 3.0
For CoreOS you will need:
[Unit]
Requires=network-online.target
There is a difference between network.target and network-online.target. network-online.target is what is pulled in when attempting to perform network-mounts in /etc/fstab, and your dependency needs are closer to that. To use it.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
