How to make docker.service wait for cni0.netdev bridge during systemd boot?












3















I'm running Ubuntu 18.04.1 LTS



I have created a cni0.netdev and cni0.network file in /etc/systemd/network to create a virtual bridge to use for a local Kubernetes cluster/node.



I have enabled systemd-networkd-wait-online.service



I have the following in docker.service [Unit]:



After=network-online.target docker.socket firewalld.service
Wants=network-online.target
Requires=docker.socket


However, when I start up, dockerd complains that cni0 isn't yet up, yet when I log in, the bridge is there. If I restart dockerd it picks up the bridge and uses it.



I can't add a After= for cni0.netdev because netdev files are configuration files for systemd-networkd and not "units" on their own.



It seems like systemd-networkd-wait-online.service just waits for "any" interface to be online, which would be the regular eth0 interface.



How can I wait for this bridge to be up and configured before dockerd is started?










share|improve this question



























    3















    I'm running Ubuntu 18.04.1 LTS



    I have created a cni0.netdev and cni0.network file in /etc/systemd/network to create a virtual bridge to use for a local Kubernetes cluster/node.



    I have enabled systemd-networkd-wait-online.service



    I have the following in docker.service [Unit]:



    After=network-online.target docker.socket firewalld.service
    Wants=network-online.target
    Requires=docker.socket


    However, when I start up, dockerd complains that cni0 isn't yet up, yet when I log in, the bridge is there. If I restart dockerd it picks up the bridge and uses it.



    I can't add a After= for cni0.netdev because netdev files are configuration files for systemd-networkd and not "units" on their own.



    It seems like systemd-networkd-wait-online.service just waits for "any" interface to be online, which would be the regular eth0 interface.



    How can I wait for this bridge to be up and configured before dockerd is started?










    share|improve this question

























      3












      3








      3








      I'm running Ubuntu 18.04.1 LTS



      I have created a cni0.netdev and cni0.network file in /etc/systemd/network to create a virtual bridge to use for a local Kubernetes cluster/node.



      I have enabled systemd-networkd-wait-online.service



      I have the following in docker.service [Unit]:



      After=network-online.target docker.socket firewalld.service
      Wants=network-online.target
      Requires=docker.socket


      However, when I start up, dockerd complains that cni0 isn't yet up, yet when I log in, the bridge is there. If I restart dockerd it picks up the bridge and uses it.



      I can't add a After= for cni0.netdev because netdev files are configuration files for systemd-networkd and not "units" on their own.



      It seems like systemd-networkd-wait-online.service just waits for "any" interface to be online, which would be the regular eth0 interface.



      How can I wait for this bridge to be up and configured before dockerd is started?










      share|improve this question














      I'm running Ubuntu 18.04.1 LTS



      I have created a cni0.netdev and cni0.network file in /etc/systemd/network to create a virtual bridge to use for a local Kubernetes cluster/node.



      I have enabled systemd-networkd-wait-online.service



      I have the following in docker.service [Unit]:



      After=network-online.target docker.socket firewalld.service
      Wants=network-online.target
      Requires=docker.socket


      However, when I start up, dockerd complains that cni0 isn't yet up, yet when I log in, the bridge is there. If I restart dockerd it picks up the bridge and uses it.



      I can't add a After= for cni0.netdev because netdev files are configuration files for systemd-networkd and not "units" on their own.



      It seems like systemd-networkd-wait-online.service just waits for "any" interface to be online, which would be the regular eth0 interface.



      How can I wait for this bridge to be up and configured before dockerd is started?







      systemd docker bridge systemd-networkd






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 23 at 21:57









      Jon WatteJon Watte

      12325




      12325






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can maybe try to add a After/Wants=sys-devices-virtual-net-cni0.device



          You can check the exact name of the device using systemctl






          share|improve this answer
























          • OK, I should try that.

            – Jon Watte
            Jan 25 at 23:10











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496335%2fhow-to-make-docker-service-wait-for-cni0-netdev-bridge-during-systemd-boot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You can maybe try to add a After/Wants=sys-devices-virtual-net-cni0.device



          You can check the exact name of the device using systemctl






          share|improve this answer
























          • OK, I should try that.

            – Jon Watte
            Jan 25 at 23:10
















          0














          You can maybe try to add a After/Wants=sys-devices-virtual-net-cni0.device



          You can check the exact name of the device using systemctl






          share|improve this answer
























          • OK, I should try that.

            – Jon Watte
            Jan 25 at 23:10














          0












          0








          0







          You can maybe try to add a After/Wants=sys-devices-virtual-net-cni0.device



          You can check the exact name of the device using systemctl






          share|improve this answer













          You can maybe try to add a After/Wants=sys-devices-virtual-net-cni0.device



          You can check the exact name of the device using systemctl







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 25 at 10:03









          BigonBigon

          1,257713




          1,257713













          • OK, I should try that.

            – Jon Watte
            Jan 25 at 23:10



















          • OK, I should try that.

            – Jon Watte
            Jan 25 at 23:10

















          OK, I should try that.

          – Jon Watte
          Jan 25 at 23:10





          OK, I should try that.

          – Jon Watte
          Jan 25 at 23:10


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f496335%2fhow-to-make-docker-service-wait-for-cni0-netdev-bridge-during-systemd-boot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to make a Squid Proxy server?

          Is this a new Fibonacci Identity?

          19世紀