Deploying a network management/documentation tool is made simple with Docker.
Netbox is a free open source tool that allows you to manage and document networks. It’s incredibly powerful and seriously useful for any busy data center admin. With Netbox you can manage:
- IP networks and addresses, VRFs, and VLANs
- Equipment racks
- Data circuits
Problem is, trying to get Netbox installed manually can be a real challenge, even for seasoned admins. Fortunately, deploying Netbox as a Docker container makes things quite simple.
I’m going to walk you through the process of deploying Netbox on Ubuntu Server 18.04, with the help of Docker.
SEE: Hiring kit: Database administrator (TechRepublic Premium)
What you’ll need
The only things you’ll need are a working instance of Ubuntu Server, although this should work on most Linux distributions, with minor modifications, and a user account with sudo privileges.
How to install Docker and docker-compose
The first thing to do is the installation of Docker. To do this, open a terminal window and issue the following commands:
- Install Docker with the command: sudo apt-get install docker.io -y.
- Add your user to the docker group with the command: sudo usermod -aG docker $USER.
- Log out and log back in to the server.
- Install docker-compose with the command: sudo curl -L “https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(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.
How to deploy Netbox
Download the necessary files for deployment with the command:
git clone -b master https://github.com/netbox-community/netbox-docker.git
This will create a new directory called netbox-docker. Change into that directory with the command:
Before you deploy the container, you’ll want to edit the .env file and configure it to meet your needs. Issue the command:
In that file, you might want to change the line:
The above is the default password for the admin user. Change that to something unique and strong. Alter any other options you might want (such as SUPERUSER_EMAIL) and save the file.
To deploy the container, issue the following commands:
docker-compose pull docker-compose up -d
This will complete the deployment.
How to access Netbox
It will take around two to five minutes before Netbox becomes available. During that time, issue the command:
echo "http://$(docker-compose port nginx 8080)/"
The above command will print out the exact port you should use to access Netbox (Figure A).
In the case of my example, the port to be used is 32768. So point a browser to http://SERVER_IP:32768 (where SERVER_IP is the IP address of the hosting server) and you should see the Netbox main page (Figure B). If the page doesn’t appear, wait for a few more minutes for the service to become available and try again.
Click Login and authenticate with the user admin and the password you added in the netbox.env file.
And that’s all there is to deploying Netbox the easy way. You are now ready to enjoy better network management/documentation.