Docker add network to container

  • So as I don't have portainer and using the compose plugin its been great ive not missed anything until now :)


    How can I add a network ive created to a container?



    Network "ph_network"



    There is no options too add it to the container my example "PiHole"


    Is there a way?

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

    • Offizieller Beitrag

    There is no options too add it to the container my example "PiHole"


    Is there a way?

    You have to do it in the yaml file. In the last part of this procedure you have an example. https://wiki.omv-extras.org/do…_the_same_lan_as_the_host

  • You have to do it in the yaml file. In the last part of this procedure you have an example. https://wiki.omv-extras.org/do…_the_same_lan_as_the_host

    So


    Code
        networks:
          mynet:
            ph_network

    like this?

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

  • used to click the button so never done it like this. does this look right?


    edit = no check failed

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

  • error I get on the check


    Code
    services.pihole.networks must be a list

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

  • I had created a MACVLAN's interface using the terminal (putty, for example)


    Simply log in as root e copy & paste this:

    IMPORTANT:

    1. You need to modify "subnet=", "gateway=" and "ip-range=" to match you LAN.

    2. Inside the OMV's web interface, under "Network" -> "Interfaces" you can see the name of the device that is necessary for "parent="


    Code
    docker network create -d macvlan \
        --subnet=192.168.0.0/24 \ #In most cases are the same
        --gateway=192.168.0.1 \
        --ip-range=192.168.0.0/24 \ #In most cases are the same
        -o parent=eno1 \
        -o macvlan_mode=bridge \
    macvlan_home #This is the name of the MACVLAN's adapter


    Then, this is an example of a stack with the MACVLAN above:


  • Yea I nomrally make it via CLI also


    Code
    sudo docker network create -d macvlan -o parent=enp2s0 --subnet=10.0.0.0/24 --gateway=10.0.0.1 --ip-range=10.0.0.200/32 ph_network

    Just unsure how to add it in the compose. Ive never added the IP like you have ive used the network name.

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

  • Just take a look at line number 7 in the code for the creation of MACVLAN's adapter: "macvlan_home" is only the name of the adapter.


    Now, in the compose, see lines 18, 28, 29, 30, 33, 34, 35


    NOTE: Why your "--subnet" and "--ip-range" are different?

  • Just take a look at line number 7 in the code for the creation of MACVLAN's adapter: "macvlan_home" is only the name of the adapter.


    Now, in the compose, see lines 18, 28, 29, 30, 33, 34, 35


    NOTE: Why your "--subnet" and "--ip-range" are different?

    Why is yours? ip-range is the IP you want for pihole from what ive read.


    Ill check it out thanks

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

  • used to click the button so never done it like this. does this look right?


    edit = no check failed

    please read my guide, perhaps can help.


  • Why is yours? ip-range is the IP you want for pihole from what ive read.


    Ill check it out thanks

    The MACVLAN's adapter can be used for different containers at same time, so "ip-range" should be, for example, "192.168.0.0/24" or whatever is your LAN; then, you need to specify the ip for the container directly inside the compose.

    • Offizieller Beitrag

    The MACVLAN's adapter can be used for different containers at same time, so "ip-range" should be, for example, "192.168.0.0/24" or whatever is your LAN; then, you need to specify the ip for the container directly inside the compose.

    If you do that you will have some conflict with your router, since that range overlaps with that of the router. The correct thing to do is to restrict the range of the vlan and the router so that they do not coincide, as explained here. https://wiki.omv-extras.org/do…_the_same_lan_as_the_host

  • If you do that you will have some conflict with your router, since that range overlaps with that of the router. The correct thing to do is to restrict the range of the vlan and the router so that they do not coincide, as explained here. https://wiki.omv-extras.org/do…_the_same_lan_as_the_host

    But my router isn't the DHCP's server (i use Pi-hole for that 8) ) and all IP manually assigned at all containers in MACVLAN are far from the range of the DHCP.

    For example, my subnet is 172.22.8.0/24.
    Pi-hole IP = 172.22.8.1 (MACVLAN)
    Router IP = 172.22.8.250
    DHCP range = 172.22.8.100 to 172.22.8.120
    IP reservation (devices with DHCP on but with a specific IP assigned, associated at its own MAC ADDRESS, outside the DHCP range) = 172.22.8.40 to 172.22.8.80
    Devices with static IP = Router (172.22.8.250), OMV (172.22.8.249).

    • Offizieller Beitrag

    But my router isn't the DHCP's server (i use Pi-hole for that 8) ) and all IP manually assigned at all containers in MACVLAN are far from the range of the DHCP.

    Okay. In that case it would be correct. I guess not everyone will use pi-hole as a DHCP server, many don't even know what IP range means. There will be some that if you tell them to do that they will end up with two DHCP servers on their network.

    I've added a note about this on the wiki, thanks for the clarification.

  • please read my guide, perhaps can help.


    Thanks ive already made the macvlan just unsure how to add it via docker compose with portainer it was two clicks job done


    Code
    networks:
       ph_network

    must be something like the code above. Ill read some more today about it. can't be that hard to tell it use this network ive made.

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

    • Offizieller Beitrag

    must be something like the code above. Ill read some more today about it. can't be that hard to tell it use this network ive made.

    Thormir84 has already explained it to you in post 6.

    Look at the indentations.

    The code that is indented at the same height as the service the network is generating.

    Code
    networks:
      macvlan_home:
        external: true

    The code that is indented inside the service is setting up that network inside the container.

    Code
        networks:
          macvlan_home:
            ipv4_address: PI-HOLE_IP #Insert here the IP of your Pi-hole container; example: 192.168.0.10
  • Thormir84 has already explained it to you in post 6.

    Look at the indentations.

    The code that is indented at the same height as the service the network is generating.

    The code that is indented inside the service is setting up that network inside the container.

    It used to be like the code live the above I posted. I never added the IP into the compose before.


    it just had ph_network in it the name of the macvlan ive made

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

  • So you are saying like this?



    If so it fails the check.

    Plugins - compose, cputemp, omv-extras, sharerootfs.

    Drives - 1tb nvme Data, 2TB nvme Leeching, 24TB (8tbx 3 merg) Media,

    Docker - nginx-proxy-manager, plex, prowlarr, qbittorrentvpn, radarr, sonarr, watchtower.

    • Offizieller Beitrag

    If so it fails the check

    I say like this:

    • Offizieller Beitrag

    If so it fails the check.

    You haven't read the wiki. I shouldn't tell you this. Not to you. ^^

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!