How to Set Up Netbox with Docker
2 min read
Deployment Options
To start playing and testing Netbox, we currently have 2 options:
Docker
Netbox Cloud (Free) -- The advantage is that it can come with pre-populated information, so you don't have to spend as much time.
Since I want to be able to test different versions, have root access, and have more flexibility to play around, let's stick with the Docker option.
In my environment, I am using Windows, so to run Docker, we first need to set up WSL.
Getting the Image
We can find instructions on how to build and run Netbox as a docker container on GitHub on the following link: netbox-docker
git clone -b release https://github.com/netbox-community/netbox-docker.git
cd netbox-docker
tee docker-compose.override.yml <<EOF
services:
netbox:
ports:
- 8000:8080
EOF
docker compose pull
docker compose up
Docker images after pulling:
Docker Containers after starting
It is quite straightforward; the whole application will be available after a few minutes. Open the URL http://0.0.0.0:8000/
in a web browser. You should see the NetBox homepage.
After bringing the containers up, we should see something like this:
Initial Setup
For the login, we can proceed in two ways:
- we can open a new terminal window and run the command as shown on github:
docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser
- We can enter the Netbox container as ROOT and run the script from there. This is how we will eventually modify the Netbox files to add plugins, scripts, and specific configurations.
docker exec -it --user=root netbox-docker-netbox-1 bash
./manage.py createsuperuser
After creating the user, we can now log in via WebUi and set our API token to start automating:
In the following posts, we will create some scripts to interact with and add information to our Netbox environment.