大网数据广告活动
服务器运维问答

Getting can't resolve host when curling dependencies in systemd

· 52CE 我爱测

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] …

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-07-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。