How to route traffic from a wifi AP via a docker container on a Raspberry Pi
0
votes
1
answer
2087
views
I have a container **A** running a VPN client, then I traffic other containers' (**B** and **C**) traffic via container **A**.
Is there a way to create a container **D**, which internally is running something like **HostAP** or **RaspAP** for the creation a wifi network in e.g. interface
wlan0
, and then all the traffic is routed via container **A**?
I found some docker images in docker hub with the above clients for my architechture, and while the few descriptions they have seem to have similar purpose to what I am trying to achieve, none of the worked properly.
If previous option is not possible, how could this be achieved by directly changing the files in the host OS (Raspbian)? The host is connected via eth0
to the router.
First I tried to run the containers directly from the interface eth0
and then tried to attach it to container **A**. None of them worked.
**Docker compose for hostap:**
sudo docker run --restart unless-stopped -dit --name hostap \
-e INTERFACE=docker0 \
-e CHANNEL=6 \
-e SSID=runssid \
-e AP_ADDR=192.168.254.1 \
-e SUBNET=192.168.254.0 \
-e WPA_PASSPHRASE=passw0rd \
-e OUTGOINGS=eth0 \
-e HW_MODE=g \
--net host --privileged sdelrio/rpi-hostap:latest
Log file:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm/v7) and no specific platform was requested
2448abea512bf5207f7692d242804b0a0198b6e076b011c311b06092af1b5d80
Then it crashes the entire raspberry docker installation (no access to any other container). I have to kill the container and eliminate to re-gain access.
** Docker compose using raspap:**
sudo docker run --name raspap -it -d --privileged --network=host -v /sys/fs/cgroup:/sys/fs/cgroup:ro --cap-add SYS_ADMIN jrcichra/raspap-docker
This one stops the container after its creation.
Log file:
systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
Detected virtualization docker.
Detected architecture arm.
Welcome to Debian GNU/Linux 10 (buster)!
Set hostname to .
Failed to create /init.scope control group: Read-only file system
Failed to allocate manager object: Read-only file system
[!!!!!!] Failed to allocate manager object.
Setup:
- Docker running on Raspbian in a Raspberry Pi 4
Docker images checked:
- https://github.com/sdelrio/rpi-hostap
- https://github.com/RaspAP/raspap-docker
Thanks in advance.
Asked by wdsgn
(101 rep)
Aug 24, 2022, 08:41 PM
Last activity: Apr 30, 2025, 10:10 AM
Last activity: Apr 30, 2025, 10:10 AM