trinib / AdGuard-WireGuard-Unbound-DNScrypt

Linux ultimate self-hosted network security guide ║ Linux 终极自托管网络安全指南 ║ Guía definitiva de seguridad de red autohospedada de Linux ║ लिनक्स परम स्व-होस्टेड नेटवर्क सुरक्षा गाइड ║ Окончательное руководство по безопасности собственной сети Linux
MIT License
729 stars 58 forks source link

Docker version #8

Open godshades opened 2 years ago

godshades commented 2 years ago

Hi, thanks for a great project Would you mind if make a docker version of this pj Or tutorial how to use with adguard (docker)

trinib commented 2 years ago

Thanks.. my plan was to make these projects more understandable and get it working, I thought about building a docker container at some point , I know it is super easy but for a while I'm focus on my app development and not planning to make one now for there is a lot of guides on docker and these projects.

But the whole idea of this repo was for people to understand this network stuff better and other people to contribute to make it better so I will create a help issue for a docker image if anyone is interested. 🙏🙏🙏

oijkn commented 2 years ago

Thanks to your great work I was able to set up a Docker with all the stuff except the VPN. It is installed on my raspberry via the PiVPN script. I'm going to continue an observation phase to see if everything works well and I'll publish my Docker.

oijkn commented 2 years ago

In my case I don't need to use a VPN in a docker. So at first I will share my work without this option. On the other hand I use OpenVPN because with a PC that does not have administrator rights it works while with Wireguard it is not the case even if it is faster.

oijkn commented 2 years ago

Hi @trinib,

Sorry for the wait but I was busy with other personal projects. Good news ! The Docker version is online and available here : https://hub.docker.com/r/oijkn/adguardhome-doh-dot

If you have any comments or questions don't hesitate to open an issue or to contact me.

Thanks again for your great work and sharing :)

trinib commented 2 years ago

@oijkn thanks I'll try it out in a while

Monirzadeh commented 2 years ago

Hi @trinib,

Sorry for the wait but I was busy with other personal projects. Good news ! The Docker version is online and available here : https://hub.docker.com/r/oijkn/adguardhome-doh-dot

If you have any comments or questions don't hesitate to open an issue or to contact me.

Thanks again for your great work and sharing :)

hi @oijkn i try to deploy that but i get in trouble for now i have my macvlan with name 'mymacvlanexist' how should i connect that to that 'mymacvlanexist' instead of create new one?

i think i should change this two part to connect network to 'mymacvlanexist' , but i don't know how.

    networks:
      macvlan0:
        ipv4_address: 192.168.1.110                                    # IP of the container for AdGuardHome, configure it to your needs

and

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0                                                     # Parent interface, configure it depending on your interface name
    ipam:
      config:
        - subnet: 192.168.1.0/24                                       # Subnet of the container
          gateway: 192.168.1.1                                         # Gateway of the network
          ip_range: 192.168.1.100/28                                   # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.100                                     # Reserved for RPi Server (IP of the host)
oijkn commented 2 years ago

@Monirzadeh can you list your network with : docker network ls and then show me detail with docker network inspect <network_name> ?

trinib commented 2 years ago

@oijkn Everything installed ok but this keeps happening(restarting)

image

Using Pi raspberry 64bit, installed docker for debian from https://docs.docker.com/engine/install/debian/

~It stated clone repo to docker data directory. I used location /var/lib/docker/ 🤷‍♂️ and I needed to be in sudo su root privilege mode~ You meant in docker-compose.yml. 😅

~I did not change anything in file~. I kept 192.168.1.110. My network has a [192.168.100.xxx] type address, do not know if that means anything

for nameserver in /etc/resolv.conf, 192.168.1.110 gets removed after restart so I used this guide : https://www.tecmint.com/set-permanent-dns-nameservers-in-ubuntu-debian/

BTW you have docker-compose up -d when docker compose up -d is the working command for me

let me know if you see what I did wrong

EDITED

crap I did not set path in volumes section 😅

trinib commented 2 years ago

hi @oijkn i try to deploy that but i get in trouble for now i have my macvlan with name 'mymacvlanexist' how should i connect that to that 'mymacvlanexist' instead of create new one?

i think i should change this two part to connect network to 'mymacvlanexist' , but i don't know how.

    networks:
      macvlan0:
        ipv4_address: 192.168.1.110                                    # IP of the container for AdGuardHome, configure it to your needs

and

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0                                                     # Parent interface, configure it depending on your interface name
    ipam:
      config:
        - subnet: 192.168.1.0/24                                       # Subnet of the container
          gateway: 192.168.1.1                                         # Gateway of the network
          ip_range: 192.168.1.100/28                                   # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.100                                     # Reserved for RPi Server (IP of the host)

did you ran docker pull oijkn/adguardhome-doh-dot first ? cause when i did i got that error

Monirzadeh commented 2 years ago

@Monirzadeh can you list your network with : docker network ls and then show me detail with docker network inspect <network_name> ?

NETWORK ID     NAME        DRIVER    SCOPE
randomnumber1   MacConfig   null      local
randomnumber2   MyMacVlan   macvlan   local
randomnumber3   bridge      bridge    local
randomnumber4   host        host      local
randomnumber5   none        null      local

inspect that not contain Adgurde but some container connect to this macvlan docker network inspect MyMacVlan output

[
    {
        "Name": "MyMacVlan",
        "Id": "randomnumber2",
        "Created": "2022-05-24T00:22:58.945708161+04:30",
        "Scope": "local",
        "Driver": "macvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.1.0/26",
                    "IPRange": "192.168.1.2/24",
                    "Gateway": "192.168.1.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": "MacConfig"
        },
        "ConfigOnly": false,
        "Containers": {
            "containerid": {
                "Name": "Radarr",
                "EndpointID": "....",
                "MacAddress": "virtualmacaddress",
                "IPv4Address": "192.168.1.4/26",
                "IPv6Address": ""
            },
        },
        "Options": {
            "parent": "enp2s0"
        },
        "Labels": {}
    }
]

i use Portainer to manage containers

Monirzadeh commented 2 years ago

hi @oijkn i try to deploy that but i get in trouble for now i have my macvlan with name 'mymacvlanexist' how should i connect that to that 'mymacvlanexist' instead of create new one? i think i should change this two part to connect network to 'mymacvlanexist' , but i don't know how.

    networks:
      macvlan0:
        ipv4_address: 192.168.1.110                                    # IP of the container for AdGuardHome, configure it to your needs

and

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0                                                     # Parent interface, configure it depending on your interface name
    ipam:
      config:
        - subnet: 192.168.1.0/24                                       # Subnet of the container
          gateway: 192.168.1.1                                         # Gateway of the network
          ip_range: 192.168.1.100/28                                   # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.100                                     # Reserved for RPi Server (IP of the host)

did you ran docker pull oijkn/adguardhome-doh-dot first ? cause when i did i got that error

i use Portainer and yes image downloaded

Monirzadeh commented 2 years ago

replace that to place you want to store data for example

    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /containersFiles/adguardhome/conf:/opt/AdGuardHome/conf          # Configure '<path_to_data>' to your needs
      - /containersFiles/adguardhome/work:/opt/AdGuardHome/work          # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints  # Configure '<path_to_data>' to your needs

above config link /opt/AdGuardHome/conf path in container to /containersFiles/adguardhome/conf path in host machine

trinib commented 2 years ago

replace that to place you want to store data for example

    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /containersFiles/adguardhome/conf:/opt/AdGuardHome/conf          # Configure '<path_to_data>' to your needs
      - /containersFiles/adguardhome/work:/opt/AdGuardHome/work          # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints  # Configure '<path_to_data>' to your needs

above config link /opt/AdGuardHome/conf path in container to /containersFiles/adguardhome/conf path in host machine

image

oijkn commented 2 years ago

HI,

@trinib Your main problem seems to be that you are on a 64 bit architecture while my image is for 32 bit. I will try to build a multi-arch image to solve this problem.

Then if you are in a 192.168.100.0/24 subnet you have to adapt the network configuration accordingly. So you have to replace 192.168.1.110 by 192.168.100.110. I guess your gateway should be 192.168.100.1, right?

I realized, that I forgot in the README to indicate the modification of the network parameters in the files located in the network directory of the Github (I will make an update of the README).

And for <path_to_data>, I mean the real path where you will install the doker stuff for AdGuardHome. Example : /data/docker/adguardhome/. I usually use the /data of my HDD to store all my docker :)

@Monirzadeh I think you have to use something like that :

version: "2"

services:
  adguardhome:
    <all previous config...>
    networks:
      - MyMacVlan

networks:
  MyMacVlan:
    external: true
Monirzadeh commented 2 years ago

@oijkn thanks now i get same error that @trinib get as you mention it is becuse of image is 32bit i will wait to build a 64bit version. where do you announce 64bit version?

trinib commented 2 years ago

HI,

@trinib Your main problem seems to be that you are on a 64 bit architecture while my image is for 32 bit. I will try to build a multi-arch image to solve this problem.

Then if you are in a 192.168.100.0/24 subnet you have to adapt the network configuration accordingly. So you have to replace 192.168.1.110 by 192.168.100.110. I guess your gateway should be 192.168.100.1, right?

I realized, that I forgot in the README to indicate the modification of the network parameters in the files located in the network directory of the Github (I will make an update of the README).

And for <path_to_data>, I mean the real path where you will install the doker stuff for AdGuardHome. Example : /data/docker/adguardhome/. I usually use the /data of my HDD to store all my docker :)

@Monirzadeh I think you have to use something like that :

version: "2"

services:
  adguardhome:
    <all previous config...>
    networks:
      - MyMacVlan

networks:
  MyMacVlan:
    external: true

Ahh i though it was these type of issues (architecture/network address) . I'll do adjustments and see how it goes. What about docker-compose up -d fixed to docker compose up -d (no-dash)

trinib commented 2 years ago

@oijkn Thanks so much again for the contribution.🔥🎉. when i add your docker links to readme and i'll finally close this💩

trinib commented 2 years ago

@oijkn when ever you feel like it or if you want to, it would be cool to make one with DNScrypt and Knot(soon to add, being setup/tested by @jo20201) with AGH. Those two are very customizable alternatives to cloudflared tunnel and unbound, to tell which has better security is hard for anyone to say unless you are network programmer and actually spends time comparing it lol.

I want DNScrypt and Knot for users who want extra features and like configuring stuff. it will be a personal preference option more advanced, unless in the future any becomes obsolete

oijkn commented 2 years ago

@trinib ok I'll have a look at it as soon as possible

@trinib @Monirzadeh Can you type this command : dpkg --print-architecture and give me the result please ? Thank

Monirzadeh commented 2 years ago

dpkg --print-architecture

amd64

oijkn commented 2 years ago

dpkg --print-architecture

amd64

It's not an Raspberry Pi 64 bit, right?

Monirzadeh commented 2 years ago

dpkg --print-architecture

amd64

It's not an Raspberry Pi 64 bit, right?

no it is a pc

oijkn commented 2 years ago

OK thanks you, @trinib can you type the same command please?

trinib commented 2 years ago

OK thanks you, @trinib can you type the same command please?

image

oijkn commented 2 years ago

Hi @trinib & @Monirzadeh I just pushed an multi-arch docker image, can you try it, please ?

image

Monirzadeh commented 2 years ago

Hi @trinib & @Monirzadeh I just pushed an multi-arch docker image, can you try it, please ?

image

hi @oijkn o get bellow error

Deployment error
failed to deploy a stack: Creating Adguardhome ...  Creating Adguardhome ... error  ERROR: for Adguardhome Cannot start service adguardhome: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/containersFiles/unbound/root.hints" to rootfs at "/var/lib/unbound/root.hints": mount /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type ERROR: for adguardhome Cannot start service adguardhome: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/containersFiles/unbound/root.hints" to rootfs at "/var/lib/unbound/root.hints": mount /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Encountered errors while bringing up the project. : exit status 1

with this config

version: "2"                                                           # Docker Compose version for Portainer

services:
  adguardhome:
    image: oijkn/adguardhome-doh-dot:latest
    container_name: Adguardhome
    hostname: rpi-adguard
    environment:
      - PUID=1000                                                      # User ID (UID)
      - PGID=100                                                       # Group ID (GID)
      - TZ=Europe/London                                                # Timezone
      - LANG=en_US.UTF8                                                # Language
      - LANGUAGE=en_US.UTF8                                            # Language (same as LANG)
    tmpfs:
      - /run
      - /run/lock
      - /tmp
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"                  # Watchtower (auto update)
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /containersFiles/adguardhome/conf:/opt/AdGuardHome/conf          # Configure '<path_to_data>' to your needs
      - /containersFiles/adguardhome/work:/opt/AdGuardHome/work          # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints  # Configure '<path_to_data>' to your needs
    cap_add:
      - NET_ADMIN
    networks:
      - MyMacVlan
    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - /containersFiles/crontab/root:/etc/crontabs/root:z               # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/tmp/unbound/root.hints      # Configure '<path_to_data>' to your needs
    restart: unless-stopped

networks:
  MyMacVlan:
    external: true

i don't know why ,but every time deployment stop with above error create network adguardhome-doh-dot_default too.

trinib commented 2 years ago

@oijkn i keep only getting image

oijkn commented 2 years ago

Hi @trinib & @Monirzadeh I just pushed an multi-arch docker image, can you try it, please ?

image

hi @oijkn o get bellow error

Deployment error
failed to deploy a stack: Creating Adguardhome ...  Creating Adguardhome ... error  ERROR: for Adguardhome Cannot start service adguardhome: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/containersFiles/unbound/root.hints" to rootfs at "/var/lib/unbound/root.hints": mount /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type ERROR: for adguardhome Cannot start service adguardhome: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/containersFiles/unbound/root.hints" to rootfs at "/var/lib/unbound/root.hints": mount /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Encountered errors while bringing up the project. : exit status 1

with this config

version: "2"                                                           # Docker Compose version for Portainer

services:
  adguardhome:
    image: oijkn/adguardhome-doh-dot:latest
    container_name: Adguardhome
    hostname: rpi-adguard
    environment:
      - PUID=1000                                                      # User ID (UID)
      - PGID=100                                                       # Group ID (GID)
      - TZ=Europe/London                                                # Timezone
      - LANG=en_US.UTF8                                                # Language
      - LANGUAGE=en_US.UTF8                                            # Language (same as LANG)
    tmpfs:
      - /run
      - /run/lock
      - /tmp
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"                  # Watchtower (auto update)
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /containersFiles/adguardhome/conf:/opt/AdGuardHome/conf          # Configure '<path_to_data>' to your needs
      - /containersFiles/adguardhome/work:/opt/AdGuardHome/work          # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints  # Configure '<path_to_data>' to your needs
    cap_add:
      - NET_ADMIN
    networks:
      - MyMacVlan
    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - /containersFiles/crontab/root:/etc/crontabs/root:z               # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/tmp/unbound/root.hints      # Configure '<path_to_data>' to your needs
    restart: unless-stopped

networks:
  MyMacVlan:
    external: true

i don't know why ,but every time deployment stop with above error create network adguardhome-doh-dot_default too.

Perhaps the problem is from service cron, network settings is missing because you are using existing macvlan network.

oijkn commented 2 years ago

@oijkn i keep only getting image

Can you provide me the result of the command : docker logs adguardhome ?

And yes you are using the good method to install Docker stuff.

Monirzadeh commented 2 years ago

issing bec

@oijkn so it is something that should fix in your side that is right? container that created (can't start) has correct network (MyMacVlan) it just create adguardhome-doh-dot_default too

trinib commented 2 years ago

@oijkn i tried 32bit and it still do not work

@oijkn i keep only getting image

Can you provide me the result of the command : docker logs adguardhome ?

And yes you are using the good method to install Docker stuff.

nothing shows

trinib commented 2 years ago

@ i will try again with fresh install 32bit

oijkn commented 2 years ago

@ i will try again with fresh install 32bit

Actually I'm trying to install an environment ARM64 over my Win10 to test my docker :)

trinib commented 2 years ago

@oijkn but is it strange 32bit works for you and not for me.. same pi and os

oijkn commented 2 years ago

@oijkn but is it strange 32bit works for you and not for me.. same pi and os

Did you edit the eth0 files in the network directory?

Can you share your docker-compose.yml and eth0 files?

trinib commented 2 years ago

yes i edit it and i got some error

Can you share your docker-compose.yml and eth0 files?

i just change ip and docker location

trinib commented 2 years ago

Did you test this on raspbery pi hardware or from windows VM?

oijkn commented 2 years ago

Did you test this on raspbery pi hardware or from windows VM?

Actually this docker stack run in my Rasp PI 4 8Go and I'm trying to mount an Qemu VM with arm64 to test it.

trinib commented 2 years ago

Did you test this on raspbery pi hardware or from windows VM?

Actually this docker stack run in my Rasp PI 4 8Go and I'm trying to mount an Qemu VM with arm64 to test it.

why you not using arm64 for the pi4?

oijkn commented 2 years ago

@oijkn are you sure you did the same thing from your guide and see it work on a raspberry pi ? why are you even on a VM ?

Because my Raspberry Pi OS is an 32 bit and I can't test 64 bit, so I need to use a VM with arm64 architecture to validate my Docker image. When all is in place I will tell you if that works 😊

trinib commented 2 years ago

@oijkn

AGH works with this

version: "2"
services:
  adguardhome:
    image: adguard/adguardhome
    container_name: adguardhome
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 784:784/udp
      - 853:853/tcp
      - 3000:3000/tcp
      - 80:80/tcp
      - 443:443/tcp
    volumes:
      - ./workdir:/opt/adguardhome/work
      - ./confdir:/opt/adguardhome/conf
    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - /home/pi/adguardhome-doh-dot/crontab/root:/etc/crontabs/root:z               # Configure '<path_to_data>' to your needs
      - /home/pi/adguardhome-doh-dot/unbound/root.hints:/tmp/unbound/root.hints      # Configure '<path_to_data>' to your needs
    restart: unless-stopped

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0                                                     # Parent interface, configure it depending on your interface name
    ipam:
      config:
        - subnet: 192.168.1.0/24                                       # Subnet of the container
          gateway: 192.168.1.1                                         # Gateway of the network
          ip_range: 192.168.1.100/28                                   # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.100    
oijkn commented 2 years ago

@oijkn

AGH works with this

version: "2"
services:
  adguardhome:
    image: adguard/adguardhome
    container_name: adguardhome
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 784:784/udp
      - 853:853/tcp
      - 3000:3000/tcp
      - 80:80/tcp
      - 443:443/tcp
    volumes:
      - ./workdir:/opt/adguardhome/work
      - ./confdir:/opt/adguardhome/conf
    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - /home/pi/adguardhome-doh-dot/crontab/root:/etc/crontabs/root:z               # Configure '<path_to_data>' to your needs
      - /home/pi/adguardhome-doh-dot/unbound/root.hints:/tmp/unbound/root.hints      # Configure '<path_to_data>' to your needs
    restart: unless-stopped

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0                                                     # Parent interface, configure it depending on your interface name
    ipam:
      config:
        - subnet: 192.168.1.0/24                                       # Subnet of the container
          gateway: 192.168.1.1                                         # Gateway of the network
          ip_range: 192.168.1.100/28                                   # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.100    

Yes but with the official Docker of AGH you don't have all the stuff with Unbound, Cloudflared & Stubby.

Today I'm not at home, so I will continue my tests tomorrow.

oijkn commented 2 years ago

@trinib on my side I don't notice any error and the docker works correctly on ARM64 architecture. If below my configuration :

root@ubuntu:/data/adguardhome-doh-dot# dpkg --print-architecture
arm64
root@ubuntu:/data/adguardhome-doh-dot# docker ps
CONTAINER ID   IMAGE                              COMMAND                  CREATED         STATUS         PORTS     NAMES
b4a4646d4e75   alpine:latest                      "crond -f -d 8"          3 minutes ago   Up 2 minutes             cron
b417925035d1   oijkn/adguardhome-doh-dot:latest   "/lib/systemd/systemd"   3 minutes ago   Up 2 minutes             adguardhome
root@ubuntu:/data/adguardhome-doh-dot# cat /data/adguardhome-doh-dot/network/interfaces.d/eth0
# Ethernet interface (eth0)
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 192.168.1.11

    # create a new network macvlan interface on top of eth0
    pre-up ip link add macvlan-shim link eth0 type macvlan mode bridge

    # assign an IP and the network space to the new network interface
    pre-up ip addr add 192.168.1.14/32 dev macvlan-shim

    # bring up the new network interface
    up ip link set macvlan-shim up

    # add a route to the container
    post-up ip route add 192.168.1.11/32 dev macvlan-shim
root@ubuntu:/data/adguardhome-doh-dot# cat docker-compose.yml
version: "2"

services:
  adguardhome:
    image: oijkn/adguardhome-doh-dot:latest
    container_name: adguardhome
    hostname: rpi-adguard
    environment:
      - PUID=1000
      - PGID=100
      - TZ=Europe/Paris
      - LANG=fr_FR.UTF8
      - LANGUAGE=fr_FR.UTF8
    tmpfs:
      - /run
      - /run/lock
      - /tmp
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - ./adguardhome/conf:/opt/AdGuardHome/conf
      - ./adguardhome/work:/opt/AdGuardHome/work
      - ./unbound/root.hints:/var/lib/unbound/root.hints
    cap_add:
      - NET_ADMIN
    networks:
      macvlan0:
        ipv4_address: 192.168.1.11  # IP of the container
    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - ./crontab/root:/etc/crontabs/root:z
      - ./unbound/root.hints:/tmp/unbound/root.hints
    restart: unless-stopped

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.1.0/24      # Subnet of the container
          gateway: 192.168.1.1        # Gateway of the container
          ip_range: 192.168.1.10/28  # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.10    # Reserved for RPi Server
Monirzadeh commented 2 years ago

@oijkn hi, do you have any progress on amd64?

oijkn commented 2 years ago

@Monirzadeh yes the multi-arch also support amd64.

trinib commented 2 years ago

@oijkn i still get image

oijkn commented 2 years ago

@oijkn install this on raspberry pi4 64bit. you have configurations for VM and locations for a pc. that is why it is not working on pi

Actually this Docker is running on my Raspberry Pi 4 with OS 32 bit, without any problem.

Can you provide me your configuration files, like me above, please? Perhaps your problem comes from the network configuration...

trinib commented 2 years ago
# Ethernet interface (eth0)
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 192.168.1.11

    # create a new network macvlan interface on top of eth0
    pre-up ip link add macvlan-shim link eth0 type macvlan mode bridge

    # assign an IP and the network space to the new network interface
    pre-up ip addr add 192.168.1.14/32 dev macvlan-shim

    # bring up the new network interface
    up ip link set macvlan-shim up

    # add a route to the container
    post-up ip route add 192.168.1.11/32 dev macvlan-shim
version: "2"

services:
  adguardhome:
    image: oijkn/adguardhome-doh-dot:latest
    container_name: adguardhome
    hostname: rpi-adguard
    environment:
      - PUID=1000
      - PGID=100
      - TZ=Europe/Paris
      - LANG=fr_FR.UTF8
      - LANGUAGE=fr_FR.UTF8
    tmpfs:
      - /run
      - /run/lock
      - /tmp
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /home/pi/adguardhome-doh-dot/adguardhome/conf:/opt/AdGuardHome/conf
      - /home/pi/adguardhome-doh-dot/adguardhome/work:/opt/AdGuardHome/work
      - /home/pi/adguardhome-doh-dot/unbound/root.hints:/var/lib/unbound/root.hints
    cap_add:
      - NET_ADMIN
    networks:
      macvlan0:
        ipv4_address: 192.168.1.11  # IP of the container
    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - /home/pi/adguardhome-doh-dot/crontab/root:/etc/crontabs/root:z
      - /home/pi/adguardhome-doh-dot/unbound/root.hints:/tmp/unbound/root.hints
    restart: unless-stopped

networks:
  macvlan0:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.1.0/24      # Subnet of the container
          gateway: 192.168.1.1        # Gateway of the container
          ip_range: 192.168.1.10/28  # Usable Host IP Range: 192.168.1.97 - 192.168.1.110
          aux_addresses:
            rpi-srv: 192.168.1.10    # Reserved for RPi Server
Monirzadeh commented 2 years ago

@Monirzadeh yes the multi-arch also support amd64.

@oijkn with this config

version: "2"                                                           # Docker Compose version for Portainer

services:
  adguardhome:
    image: oijkn/adguardhome-doh-dot:latest
    container_name: Adguardhome
    hostname: rpi-adguard
    environment:
      - PUID=1000                                                      # User ID (UID)
      - PGID=100                                                       # Group ID (GID)
      - TZ=Europe/London                                                 # Timezone
      - LANG=en_US.UTF8                                                # Language
      - LANGUAGE=en_US.UTF8                                            # Language (same as LANG)
    tmpfs:
      - /run
      - /run/lock
      - /tmp
#    labels:
#      - "com.centurylinklabs.watchtower.enable=true"                  # Watchtower (auto update)
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /containersFiles/adguardhome/conf:/opt/AdGuardHome/conf          # Configure '<path_to_data>' to your needs
      - /containersFiles/adguardhome/work:/opt/AdGuardHome/work          # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints  # Configure '<path_to_data>' to your needs
    cap_add:
      - NET_ADMIN
    networks:
      - MyMacVlan

    restart: unless-stopped

  cron:
    image: alpine:latest
    container_name: cron
    hostname: rpi-cron
    command: crond -f -d 8
    depends_on:
      - adguardhome
    volumes:
      - /containersFiles/crontab/root:/etc/crontabs/root:z               # Configure '<path_to_data>' to your needs
      - /containersFiles/unbound/root.hints:/tmp/unbound/root.hints      # Configure '<path_to_data>' to your needs
    restart: unless-stopped

networks:
  MyMacVlan:
    external: true

i get this error

Deployment error
failed to deploy a stack: Creating network "adguardhome-doh-dot_default" with the default driver Pulling adguardhome (oijkn/adguardhome-doh-dot:latest)... 
Pulling cron (alpine:latest)...
Creating Adguardhome ...
Creating Adguardhome ...
merror ERROR: for Adguardhome Cannot start service adguardhome: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/containersFiles/unbound/root.hints" to rootfs at "/var/lib/unbound/root.hints": mount /containersFiles/unbound/root.hints:/var/lib/unbound/root.hints (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type ERROR: for adguardhome Cannot start service adguardhome: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting

do i something worg or need any specific change in my config?

trinib commented 2 years ago

@oijkn my network image