Skip to content

Feature request -- official docker container #458

Closed

Description

@bf8392

Hi :-) It would be really nice to see an official docker-contianer for this software :-). Because I use to run software ONLY in container like rancher os (keeps mantainance low). Any possibility to see this? :-) maybe I can help developing :-)

Activity

  1. mlavelle42 commented on Jan 24, 2020

    @mlavelle42

    Second this request.

  2. billz commented on Jan 27, 2020

    @billz
    Member

    @bd8392 I don't really have bandwidth for this now, but if you'd like to kickstart things perhaps myself and others could collaborate on it :)

  3. glaszig commented on Mar 1, 2020

    @glaszig
    Contributor

    enlighten me, please. how does docker handle management of the host’s network interfaces? built-in and usb dongles? can you run hostapd inside a container?

  4. glaszig commented on Mar 1, 2020

    @glaszig
    Contributor

    sorry, i enlightened myself. apparently you can indeed. looks like quite some work: https://github.com/fgg89/docker-ap

  5. bf8392 commented on Mar 1, 2020

    @bf8392
    Author

    By bind the etc/interfaces to docker as volume, you can alter it's settings...maybe this is easier...

  6. glaszig commented on Mar 1, 2020

    @glaszig
    Contributor

    By bind the etc/interfaces to docker as volume, you can alter it's settings...maybe this is easier...

    go, go, go!

  7. noxPHX commented on Mar 10, 2020

    @noxPHX

    I managed to run RaspAP within a Docker container without it being privileged or running within the host network namespace (the wifi interface must be moved into the container netns so to speak) for some security concerns.
    I still stumble upon some web interface errors but nothing serious as the AP is working great so far so I need to do some more tweaks as well as checking the capabilities needed before sharing my work to you if you are interested.

  8. bf8392 commented on Mar 11, 2020

    @bf8392
    Author

    Wow that's great! Yes I'm always interested in dockerized apps :-) thanks for all the effort you've done! @noxPHX. Maybe you can post it here, so the docker can become official and others can use it :-). Very cool that you've done it :-)

  9. pinned this issue on Mar 12, 2020
  10. 1ubuntuuser commented on May 25, 2020

    @1ubuntuuser

    Great stuff! I heavily use docker so because of #579 a direct install of raspAP won't work in my situation.

    @noxPHX Any progress on the container? if not perhaps share the docker image so we can work on it together?
    Edit:
    I meant Dockerfile, not image.

  11. jrcichra commented on Jun 10, 2020

    @jrcichra

    I would also be interested in helping with this. Interoperability of raspap and docker would be very beneficial for me.

  12. billz commented on Jun 10, 2020

    @billz
    Member

    How about a new repo dedicated to this, with participants on this issue as collaborators?

  13. jrcichra commented on Jun 11, 2020

    @jrcichra

    Sure @billz that works for me.

    However, we could also investigate what breaks RaspAP when docker is installed on the same system and how we can fix it? The install process for RaspAP is pretty streamlined as it is. A docker container might be overkill for how many systemd services are involved. It may turn into a docker-compose deployment, behind more networking complexity.

    I think the investigation approach also solves @danielwilson654 's problem. We just want to run Docker and RaspAP on the same Pi.

  14. 18 remaining items

  15. 1ubuntuuser commented on May 9, 2021

    @1ubuntuuser

    @noxPHX thanks I've had a look. I'll get testing. Does client mode work with your setup?

  16. luandro commented on Nov 1, 2021

    @luandro

    @jrcichra I see u were trying to get RaspAP to work with Balena. Have you managed to get it deployed?

    I started a discussion around this at the Balena forum. But still have no idea how to move forward.

  17. billz commented on Nov 1, 2021

    @billz
    Member

    @luandro we'd love to see RaspAP deployed with Balena.
    frankly @jrcichra is the real docker expert here. I'm available to help push things forward

  18. jrcichra commented on Nov 2, 2021

    @jrcichra

    Hi, I have a spare Pi I can qualify with the Balena docker image. I have more container/Linux know-how since last year so I should be able to assist more. Things like adblock and VPN should work if we set --network=host. Interacting with hardware will be done with the --privileged flag. Essentially we'll be using the docker container to isolate all the config files and processes, but with none of the networking abstractions.

    We'll want to make sure nothing on the host system will clash with what's being described in the RaspAP container. Disabling daemons like wpa-supplicant outside the container might be necessary. It might take some work to get it feature-compatible...and it might take more than just a docker run for the end-user.

  19. luandro commented on Nov 2, 2021

    @luandro

    This is the Balena docker-compose I'm trying:

    version: '2.1'
    
    services:
      hotspot:
        image: jrcichra/raspap-docker:latest  
        privileged: true
        network_mode: host
        labels:
          io.balena.features.sysfs: '1'
        cap_add:
          - SYS_ADMIN
    
  20. jrcichra commented on Nov 2, 2021

    @jrcichra

    Ok. I think I'm where you're at. The guide at https://github.com/RaspAP/raspap-docker still works where the webgui comes up. But starting the hotspot in the container fails:

    Nov 02 21:10:02 jpi systemd[1]: hostapd.service: Service RestartSec=2s expired, scheduling restart.
    Nov 02 21:10:02 jpi systemd[1]: hostapd.service: Scheduled restart job, restart counter is at 8.
    Nov 02 21:10:02 jpi systemd[1]: Stopped Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
    Nov 02 21:10:02 jpi systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
    Nov 02 21:10:02 jpi systemd[1]: hostapd.service: Control process exited, code=exited, status=1/FAILURE
    Nov 02 21:10:02 jpi systemd[1]: hostapd.service: Failed with result 'exit-code'.
    Nov 02 21:10:02 jpi systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
    

    ...but that's a separate problem we can get to once we're on Balena.

    I remember now that the jrcichra/raspapd is based on some random outdated systemd container. A potential first step is getting systemd running in Balena. The downside of systemd in a container is...when you're building the container, systemd is not running. So the install script needs to do systemctl enable <service> and not systemctl enable --now <service>. That's why in the existing container, I have the user do the install script by hand.

    So step 1 seems to be Balena systemd to support hostapd, dnsmasq, dhcpcd, lighttpd, etc easily. https://github.com/alehaa/docker-debian-systemd might be a good reference we can slide Balena under.

  21. jrcichra commented on Nov 2, 2021

    @jrcichra

    I was able to get systemd at least running in the container with this Dockerfile slimmed down from the work https://github.com/alehaa/docker-debian-systemd did:

    FROM balenalib/raspberry-pi-debian:buster
    RUN install_packages systemd systemd-sysv cron anacron
    RUN systemctl mask --   \
        dev-hugepages.mount \
        sys-fs-fuse-connections.mount
    RUN rm -f           \
        /etc/machine-id \
        /var/lib/dbus/machine-id
    ENV container docker
    STOPSIGNAL SIGRTMIN+3
    VOLUME [ "/sys/fs/cgroup", "/run", "/run/lock", "/tmp" ]
    CMD [ "/sbin/init" ]
    
    

    Next I'll see if I can install the script with the container running.

  22. jrcichra commented on Nov 2, 2021

    @jrcichra

    I'm where I was at before. Using Belena as a base is much nicer, especially with install_packages. I'm getting this output for hostapd when enabling the hotspot:

    Nov 02 22:20:21 jpi systemd[1]: Stopped Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
    Nov 02 22:20:21 jpi systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
    Nov 02 22:20:21 jpi hostapd[562]: Configuration file: /etc/hostapd/hostapd.conf
    Nov 02 22:20:21 jpi hostapd[562]: rfkill: WLAN soft blocked
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: Could not connect to kernel driver
    Nov 02 22:20:21 jpi hostapd[562]: Using interface wlan0 with hwaddr b8:27:eb:97:25:f1 and ssid "raspi-webgui"
    Nov 02 22:20:21 jpi hostapd[562]: Failed to set beacon parameters
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: Could not connect to kernel driver
    Nov 02 22:20:21 jpi hostapd[562]: Interface initialization failed
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: interface state COUNTRY_UPDATE->DISABLED
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: AP-DISABLED
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: Unable to setup interface.
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: interface state DISABLED->DISABLED
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: AP-DISABLED
    Nov 02 22:20:21 jpi hostapd[562]: wlan0: CTRL-EVENT-TERMINATING
    Nov 02 22:20:21 jpi hostapd[562]: hostapd_free_hapd_data: Interface wlan0 wasn't started
    Nov 02 22:20:21 jpi hostapd[562]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
    Nov 02 22:20:21 jpi systemd[1]: hostapd.service: Control process exited, code=exited, status=1/FAILURE
    Nov 02 22:20:21 jpi systemd[1]: hostapd.service: Failed with result 'exit-code'.
    Nov 02 22:20:21 jpi systemd[1]: Failed to start Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
    

    It looks like we can't interact with the wlan0 kernel driver:

    Nov 02 22:20:21 jpi hostapd[562]: wlan0: Could not connect to kernel driver
    

    ...even though we should be able to interact with the host kernel (in theory).

    I got here by doing:

    docker build -t jrcichra/balena-systemd .
    docker run --name raspap -it -d --privileged --network=host -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add SYS_ADMIN jrcichra/balena-systemd
    docker exec -it raspap bash
    curl -sL https://install.raspap.com | bash
    ... go through the prompts saying yes
    let it restart the container
    docker restart raspap
    

    Then the webgui should appear on port 80 and if you do

    journalctl -u hostapd -f
    

    ...while trying to turn on Hotspotting you should be in the same boat with the wlan0 failure.

  23. jrcichra commented on Nov 2, 2021

    @jrcichra

    Ok, by dealing with rfkill and disabling systemd-resolved + wpa_supplicant where I could, I was able to start up hostapd and dnsmasq in the container. I can see the wifi SSID and the password works. Where I'm stuck now is with dnsmasq-dhcp. I can't get an IP address from the AP. I'm getting this error, but the config (I believe) is set up properly to serve dhcp:

    ==> 090_wlan0.conf <==
    # RaspAP wlan0 configuration
    interface=wlan0
    dhcp-range=10.3.141.50,10.3.141.255,0.0.0.0,12h
    dhcp-option=6,1.1.1.1,1.0.0.1
    
    ==> README <==
    # All files in this directory will be read by dnsmasq as 
    # configuration files, except if their names end in 
    # ".dpkg-dist",".dpkg-old" or ".dpkg-new"
    #
    # This can be changed by editing /etc/default/dnsmasq
    
    
    root@jpi:/etc/dnsmasq.d# tail -f /tmp/dnsmasq.log
    Nov  2 23:10:27 dnsmasq[1145]: using nameserver 10.0.0.1#53
    Nov  2 23:10:27 dnsmasq[1145]: read /etc/hosts - 5 addresses
    Nov  2 23:10:29 dnsmasq[1145]: read /etc/raspap/adblock/hostnames.txt - 142490 addresses
    Nov  2 23:10:35 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    Nov  2 23:10:39 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    Nov  2 23:10:44 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    Nov  2 23:10:49 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    Nov  2 23:10:53 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    Nov  2 23:11:02 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    Nov  2 23:11:16 dnsmasq-dhcp[1145]: no address range available for DHCP request via wlan0
    
    root@jpi:/etc/dnsmasq.d# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether b8:27:eb:c2:70:a4 brd ff:ff:ff:ff:ff:ff
        inet 10.0.0.182/24 brd 10.0.0.255 scope global dynamic noprefixroute eth0
           valid_lft 85808sec preferred_lft 75008sec
        inet6 fd38:65c3:b703:0:2080:69f:2cd0:851/64 scope global mngtmpaddr noprefixroute 
           valid_lft forever preferred_lft forever
        inet6 fdb3:dd5c:79f7:0:e0d2:632b:a43b:2b51/64 scope global mngtmpaddr noprefixroute 
           valid_lft forever preferred_lft forever
        inet6 fe80::c106:e0a:badc:12c9/64 scope link 
           valid_lft forever preferred_lft forever
    3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether b8:27:eb:97:25:f1 brd ff:ff:ff:ff:ff:ff
        inet 169.254.151.177/16 brd 169.254.255.255 scope global noprefixroute wlan0
           valid_lft forever preferred_lft forever
        inet6 fe80::f46f:c75e:5fbd:ad5b/64 scope link 
           valid_lft forever preferred_lft forever
    4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
        link/ether 02:42:01:9f:bf:c4 brd ff:ff:ff:ff:ff:ff
        inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
           valid_lft forever preferred_lft forever
    root@jpi:/etc/dnsmasq.d# 
    
    
  24. luandro commented on Nov 2, 2021

    @luandro

    @jrcichra Not sure it helps, but this is how I usually setup dnsmasq/dhcp:

    interface=wlan0 # Listening interface
    dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
                    # Pool of IP addresses served via DHCP
    domain=wlan     # Local wireless DNS domain
    
  25. jrcichra commented on Nov 2, 2021

    @jrcichra

    @luandro yeah, I'd think that would work but for some reason it doesn't:

    root@jpi:/etc/dnsmasq.d# head -999 *
    ==> 090_adblock.conf <==
    conf-file=/etc/raspap/adblock/domains.txt
    addn-hosts=/etc/raspap/adblock/hostnames.txt
    
    ==> 090_raspap.conf <==
    # RaspAP default config
    log-facility=/tmp/dnsmasq.log
    conf-dir=/etc/dnsmasq.d
    log-dhcp
    log-queries
    
    
    ==> 090_wlan0.conf <==
    interface=wlan0 # Listening interface
    dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
                    # Pool of IP addresses served via DHCP
    domain=wlan     # Local wireless DNS domain
    
    ==> README <==
    # All files in this directory will be read by dnsmasq as 
    # configuration files, except if their names end in 
    # ".dpkg-dist",".dpkg-old" or ".dpkg-new"
    #
    # This can be changed by editing /etc/default/dnsmasq
    
    systemctl restart dnsmasq
    
    root@jpi:/etc/dnsmasq.d# tail -f /tmp/dnsmasq.log
    Nov  2 23:31:54 dnsmasq-dhcp[1244]: DHCP, IP range 192.168.4.2 -- 192.168.4.20, lease time 1d
    Nov  2 23:31:54 dnsmasq[1244]: reading /etc/resolv.conf
    Nov  2 23:31:54 dnsmasq[1244]: using nameserver 10.0.0.1#53
    Nov  2 23:31:54 dnsmasq[1244]: read /etc/hosts - 5 addresses
    Nov  2 23:31:56 dnsmasq[1244]: read /etc/raspap/adblock/hostnames.txt - 142490 addresses
    Nov  2 23:32:16 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:32:18 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:32:22 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:32:31 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:32:48 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:32:56 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:33:01 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:33:05 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    Nov  2 23:33:14 dnsmasq-dhcp[1244]: no address range available for DHCP request via wlan0
    ^C
    root@jpi:/etc/dnsmasq.d# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether b8:27:eb:c2:70:a4 brd ff:ff:ff:ff:ff:ff
        inet 10.0.0.182/24 brd 10.0.0.255 scope global dynamic noprefixroute eth0
           valid_lft 84455sec preferred_lft 73655sec
        inet6 fd51:de9e:9c6d:0:2404:4818:84c2:454a/64 scope global mngtmpaddr noprefixroute 
           valid_lft forever preferred_lft forever
        inet6 fd32:db85:3f4f:0:db2a:61b0:9b30:ebe3/64 scope global mngtmpaddr noprefixroute 
           valid_lft forever preferred_lft forever
        inet6 fd38:65c3:b703:0:2080:69f:2cd0:851/64 scope global mngtmpaddr noprefixroute 
           valid_lft forever preferred_lft forever
        inet6 fdb3:dd5c:79f7:0:e0d2:632b:a43b:2b51/64 scope global mngtmpaddr noprefixroute 
           valid_lft forever preferred_lft forever
        inet6 fe80::c106:e0a:badc:12c9/64 scope link 
           valid_lft forever preferred_lft forever
    3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether b8:27:eb:97:25:f1 brd ff:ff:ff:ff:ff:ff
        inet 169.254.151.177/16 brd 169.254.255.255 scope global noprefixroute wlan0
           valid_lft forever preferred_lft forever
        inet6 fe80::f46f:c75e:5fbd:ad5b/64 scope link 
           valid_lft forever preferred_lft forever
    4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
        link/ether 02:42:01:9f:bf:c4 brd ff:ff:ff:ff:ff:ff
        inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
           valid_lft forever preferred_lft forever
    root@jpi:/etc/dnsmasq.d# 
    
    

    We're very close though!!!

  26. unpinned this issue on Jun 4, 2023
  27. NL-TCH commented on May 9, 2024

    @NL-TCH
    Contributor
  28. billz commented on May 10, 2024

    @billz
    Member

    @NL-TCH it sure can, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions