Configuring Unifi Controller using Docker
In today’s digital age, network management has become increasingly complex. The Unifi controller is a powerful tool that provides centralized control over multiple devices on your network. Installing it using Docker simplifies the process and ensures all dependencies are met without manual installation. In this post, we will walk you through the step-by-step process of configuring the Unifi controller using Docker.
Requirements:
Need to have Docker installed, you can install from the Docker Website. You can follow our guides in Installing Docker on Windows and Install Docker on MacOS.
First, create a Docker network using the macvlan driver by executing the following command in your terminal:
docker network create -d macvlan -o parent='[DISPOSITIVO DE REDE PRINCIPAL]' --subnet [MÁSCARA DE RED] --gateway [ENDEREÇO DE GATWAY] --ip-range [FAIXA DE IP] unifi_ip
Substituting the placeholders with your actual values:
[DISPOSITIVO DE REDE PRINCIPAL]
should be replaced with the name of your primary network device (e.g., eth0).[MÁSCARA DE RED]
should be replaced with your subnet mask (e.g., 192.168.1.0/24).[ENDEREÇO DE GATWAY]
should be replaced with your gateway address (e.g., 192.168.1.1).[RANGE DE IPs]
should be replaced with your IP range (e.g., 192.168.1.0/24).
This command creates a network that will be used by your Unifi controller container.
Next, create a docker-compose.yml file containing the following content:
version: '3.7'
services:
controller:
image: "jacobalberty/unifi:${TAG:-latest}"
container_name: unifi-controller
hostname: unifi
networks:
unifi_ip:
ipv4_address: '[FIXED IP ADDRESS]'
ports:
- "3478:3478/udp" # STUN
- "6789:6789/tcp" # Speed test
- "8080:8080/tcp" # Device/ controller comm.
- "8443:8443/tcp" # Controller GUI/API as seen in a web browser
- "8880:8880/tcp" # HTTP portal redirection
- "8843:8843/tcp" # HTTPS portal redirection
- "10001:10001/udp" # AP discovery
environment:
TZ: 'Europe/Lisbon'
volumes:
- ./data:/unifi/data
- ./log:/unifi/log
- ./cert:/unifi/cert
init: true
restart: always
networks:
unifi_ip:
external: true
Substituting [ENDEREÇO IP FIXO]
with the fixed IP address you want to assign to your Unifi controller container in your network.
This file defines the environment and configuration necessary for your Unifi controller container to function correctly.
Finally, execute the following command to start the container using Docker Compose:
docker-compose up -d
This starts the Unifi controller container in the environment defined by the docker-compose.yml file.
That’s it! You have successfully set up your Unifi controller using Docker.