Wednesday, May 29, 2024
Google search engine
HomeContainersHow To Install Netbox IPAM in Docker Containers

How To Install Netbox IPAM in Docker Containers

Netbox is a free and open-source tool used to manage and document computer networks via the web. Netbox IPAM is written in Django. It helps ease the task of creating virtual implementations of devices in a data center which initially were being done on paper. The amazing features of Netbox IPAM include the following:

  • Vlan Management
  • VRF Management
  • IPAM – IP Address Management
  • CIM – Data Center Infrastructure Management
  • Circuit Provider Management
  • Multi-Site (tenancy)
  • Single Converged Database
  • Rack Elevation
  • Report Alert
  • Connection Management – Interfaces/Console/Power
  • Customization Header For Logo’s etc

Install Netbox

The first thing to do is the installation of Docker. To do this, open a terminal window and issue the following commands:

## On Debian/Ubuntu
sudo apt update && sudo apt upgrade
sudo apt install curl vim git

## On RHEL/CentOS/RockyLinux 8
sudo yum -y update
sudo yum -y install curl vim git

## On Fedora
sudo dnf update
sudo dnf -y install curl vim git

Install Docker with the command:

sudo apt-get install -y

or you can check previous post

Add your user to the docker group with the command:

sudo usermod -aG docker $USER
newgrp docker

Log out and log back in to the server. Install docker-compose with the command:

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Change the permission of the docker-compose command with the command:

sudo chmod +x /usr/local/bin/docker-compose

Start the docker daemon with the command

sudo systemctl start docker

Enable the docker daemon with the command

sudo systemctl enable docker

Provision the Netbox IPAM server

All the components needed to build Netbox as a docker container are provided in the Github repository. Now git clone the Netbox docker file as below.

git clone -b release

go to Netbox directory

cd netbox-docker

Modify the docker-compose.yml from the docker-compose.override.yml.example file as below.

tee docker-compose.override.yml <<EOF
version: '3.4'
      - 8000:8080

Now we are set to start our docker container. But first, pull the required images for Netbox, PostgreSQL, Redis e.t.c

docker-compose pull

Several images will be pulled as below

 ⠿ postgres Pulled                                                                                                                              13.5s
   ⠿ 9f97b97dbe44 Pull complete                                                                                                                  3.5s
   ⠿ 1b95022c44c5 Pull complete                                                                                                                  3.7s
   ⠿ 560a1e367f24 Pull complete                                                                                                                  8.0s
   ⠿ 41255ef20c58 Pull complete                                                                                                                  8.3s
   ⠿ 13107d5a09d7 Pull complete                                                                                                                  8.6s
   ⠿ 234db58e5916 Pull complete                                                                                                                  8.8s
   ⠿ 98ce0f30aef7 Pull complete                                                                                                                  9.1s
 ⠿ redis Pulled                                                                                                                                  9.3s
   ⠿ 97518928ae5f Already exists                                                                                                                 0.8s
   ⠿ 66f8c4150d27 Pull complete                                                                                                                  2.5s
 ⠿ redis-cache Pulled                                                                                                                            9.3s
   ⠿ 09a8bf17a0bf Pull complete                                                                                                                  3.1s
   ⠿ e547313af8e7 Pull complete                                                                                                                  4.0s
   ⠿ 335eeadfbde0 Pull complete                                                                                                                  4.6s
   ⠿ 7151fc2c01eb Pull complete 

Start the Netbox IPAM container.

docker-compose up -d

Sample Output:

[+] Running 10/10
 ⠿ Network netbox-docker_default                  Created                  0.2s
 ⠿ Volume "netbox-docker_netbox-media-files"      Created                  0.0s
 ⠿ Volume "netbox-docker_netbox-postgres-data"    Created                  0.0s
 ⠿ Volume "netbox-docker_netbox-redis-data"       Created                  0.0s
 ⠿ Container netbox-docker-redis-cache-1          Created                  0.7s
 ⠿ Container netbox-docker-postgres-1             Created                  0.6s
 ⠿ Container netbox-docker-redis-1                Created                  0.7s
 ⠿ Container netbox-docker-netbox-worker-1        Created                  0.5s
 ⠿ Container netbox-docker-netbox-housekeeping-1  Created                  0.5s
 ⠿ Container netbox-docker-netbox-1               Created                  0.3s
Attaching to netbox-docker-netbox-1, netbox-docker-netbox-housekeeping-1, netbox-docker-netbox-worker-1, netbox-docker-postgres-1, netbox-docker-redis-1, netbox-docker-redis-cache-1

netbox-docker-netbox-1               | ⏳ Waiting for control socket to be created... (1/10)
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [warn] 7#7 Unit is running unprivileged, then it cannot use arbitrary user and group.
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [info] 7#7 unit started
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [info] 20#20 discovery started
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [notice] 20#20 module: python 3.9.5 "/usr/lib/unit/modules/"
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [info] 7#7 controller started
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [notice] 7#7 process 20 exited with code 0
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [info] 22#22 router started
netbox-docker-netbox-1               | 2021/11/15 10:37:29 [info] 22#22 OpenSSL 1.1.1l  24 Aug 2021, 101010cf
netbox-docker-netbox-1               | ⚙️ Applying configuration from /etc/unit/nginx-unit.json
netbox-docker-netbox-1               | 2021/11/15 10:37:30 [info] 26#26 "netbox" application started
netbox-docker-netbox-1               | ✅ Unit configuration loaded successfully
netbox-docker-netbox-1               | 2021/11/15 10:37:31 [notice] 7#7 process 18 exited with code 0

When you see the above output, the process has been completed, now exit, proceed and verify the containers are running:

docker ps -a


CONTAINER ID   IMAGE                               COMMAND                  CREATED        STATUS        PORTS                                       NAMES
a78d7570bae0   netbox:latest-plugins               "/sbin/tini -- /opt/…"   25 hours ago   Up 25 hours>8080/tcp, :::8000->8080/tcp   netboxdocker_netbox_1
68d58ff8d53f   netboxcommunity/netbox:v3.1-1.6.0   "/sbin/tini -- /opt/…"   25 hours ago   Up 25 hours                                               netboxdocker_netbox-housekeeping_1
d9a1b53b27a9   netbox:latest-plugins               "/sbin/tini -- /opt/…"   25 hours ago   Up 25 hours                                               netboxdocker_netbox-worker_1
e21bb47a7712   redis:6-alpine                      "docker-entrypoint.s…"   25 hours ago   Up 25 hours   6379/tcp                                    netboxdocker_redis-cache_1
f37e37060a2a   redis:6-alpine                      "docker-entrypoint.s…"   25 hours ago   Up 25 hours   6379/tcp                                    netboxdocker_redis_1
06e17d6cabbf   postgres:14-alpine                  "docker-entrypoint.s…"   25 hours ago   Up 25 hours   5432/tcp                                    netboxdocker_postgres_1

If you have a firewall enabled, allow port 8000 as below

##For Firewalld
sudo firewall-cmd --zone=public --add-port=8000/tcp --permanent
sudo firewall-cmd --reload

##For UFW
sudo ufw allow 8000/tcp

Access the Netbox IPAM tool Web UI

Everything is set, we can now proceed and access the Netbox IPAM web UI with the URL http://Hostname:8000 or http://IP_Address:8000.

In case you want to stop all the running containers, run the below command:

docker-compose stop

You can remove the containers as below.

docker-compose stop && docker-compose rm

hope this article will help you 🙂


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online. to search or browse the published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or more ) as a token of appreciation.

Support Us

System & Network Administrator Ninja


Please enter your comment!
Please enter your name here

18 − two =

- Advertisment -
Google search engine

Most Popular

Recent Comments