Skip to content

Running in Docker (recommended)

Znerox edited this page May 25, 2021 · 5 revisions

Getting Docker running

Instead of manually setting up a web server with PHP support and a MySQL database, the whole system can be run in self-contained Docker containers. Here's documentation on how to install Docker Engine on Debian. You might also need to do apt-get install docker-compose.
Once Docker is installed, you need to tell Docker how to set up wifimap. There is a premade file that contains all the needed instructions. You can download the file and run it by typing:

$ curl -sSL https://raw.githubusercontent.com/Znerox/wifimap/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d

That's all you need to do, and Docker will take care of the rest. If needed, the ports the webservers run on can be changed in the docker-compose.yml file.

Accessing the system

If your Docker host is on 192.168.1.10, the various webpages will now be available on these ports/addresses:

  • Map of WiFi networks: 192.168.1.10
  • Tools for uploading data: 192.168.1.10/tools
  • Bluetooth clients: 192.168.1.10/bluetooth
  • Database management: 192.168.1.10:8080 (login is root/password)

General tips

Some general, useful Docker commands:

  • Bring up all wifimap containers: docker-compose up -d (from the folder where docker-compose.yml is located)
  • Bring down all wifimap containers: docker-compose down(from the folder where docker-compose.yml is located)
  • List running containers: docker ps
  • List all containers: docker ps -a
  • Update container (if update available): docker pull znerox/wifimap docker pull mysql
    docker pull phpmyadmin/phpmyadmin
  • List images: docker images
  • Remove old image: docker rmi image replace image with IMAGE ID (you only need the first few characters)

docker-compose.yml example:

version: "2"

services:
  wifimap:
    image: znerox/wifimap
    hostname: wifimap
    container_name: wifimap
    restart: always
    ports:
      - 80:80
    depends_on:
        - wifimap-mysql

  wifimap-phpmyadmin:
    image: phpmyadmin/phpmyadmin
    hostname: wifimap-phpmyadmin
    container_name: wifimap-phpmyadmin
    restart: always
    ports:
        - 8080:80
    environment:
        PMA_HOST: wifimap-mysql
    depends_on:
        - wifimap-mysql
    environment:
        - server=wifimap-mysql
        - database=wifimap
        - username=root
        - password=password

  wifimap-mysql:
    image: mysql
    hostname: wifimap-mysql
    container_name: wifimap-mysql
    restart: always
    volumes:
        - db_data:/var/lib/mysql
    environment:
        MYSQL_ROOT_PASSWORD: password

volumes:
  db_data:

Running container without using docker-compose

Using docker-compose will set up a MySQL database server, and get the system up and running quickly. But in some situations this is impractical, for example if you already have a database server running (like MariaDB or MySQL). To run the Docker container with an existing database, pass arguments along to the container like this: docker run -e "server=DATABASE_IP_or_hostname" -e "database=DATABASE" -e "username=USERNAME" -e "password=PASSWORD" znerox/wifimap