Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatteoOreficeIT/7abe5107668485dd6599dbac1856785c to your computer and use it in GitHub Desktop.
Save MatteoOreficeIT/7abe5107668485dd6599dbac1856785c to your computer and use it in GitHub Desktop.
systemd unit to write network metadata informations
[Unit]
Description=Write Network Configurations Metadata to /run/network/meta-environ
Requires=network-online.target
After=network-online.target
Before=containerd.service docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c "FILE=/run/network/meta-environ ; hostname -i | sed -e '$ s/^/HOST_ADDRESS_IPV4=/' > $FILE"
ExecStop=/bin/rm /run/network/meta-environ
[Install]
RequiredBy=containerd.service docker.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment