How to create a docker container as wifi access point. Target is Raspberry Pi and tested on 4B and Zero W.
Container is based on Alpine and contains hostapd and dnsmasq.
Reason for this small project is to create a mesh network based on batman-adv in the background on the actual hosts and adding AP's as dockers above. To make this work on Raspberry you need a second wifi adapter. In this project a mix has been used of an old Belkin adapter and more modern ALFA AWUS036ACH.
Prequisites
- Raspberry Pi OS, (most proably other linux dists will work also but not tested).
- Docker installed
Installation
- clone repo: git clone https://github.com/Torkelen/piDockerAP.git
- enter piDockerAP: cd piDockerAP
- Copy piDockerAP.conf.tpl to piDockerAP.conf: cp piDockerAP.conf.tpl piDockerAP.conf
- Edit piDockerAP.conf with needed settings like container names, ip, wifi etc
- Create image by executing: docker build -t pidockerap . Currently running Alpine:3.12, latest has some problems. Feel free to change to other dist in Dockerfile.
- You can check that your images exists with: docker image ls
- Create and/or start you docker with: ./runPiDocker.sh First run will create your docker container and using settings from your conf-file and start it. Container will not restart automatically after reboot. That is not possible since wlan interface needs to added to existing process for the container. To start after reboot add ./runPiDocker.sh in autostart like /etc/rc.local
Tips and trix
docker exec -it "your container" bash to view your container and work with it. use batctl and batman-adv to create a mesh network as backend for your AP's.