Install Netbox on Docker

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

To get Netbox Docker up and running run the following commands. There is a more complete Getting Started guide on our wiki which explains every step.

Create Direcotry:

mkdir /var/netbox
cd /var/netbox
git clone -b release https://github.com/netbox-community/netbox-docker.git
cd netbox-docker
tee docker-compose.override.yml <<EOF
version: '3.4'
services:
nginx:
ports:
- 8000:8080
EOF
docker-compose pull
docker-compose up (allow to run docker in the foregorund)
docker-compose up -d  (allow to run docker in the background)

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. In the top-right corner you can login. The default credentials are:

Username: admin
Password: admin
API Token: 0123456789abcdef0123456789abcdef01234567

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. In my case the following output is printed:

http://0.0.0.0:8000/

Tips:

Before you deploy the container, you’ll want to edit the .env file and configure it to meet your needs. Issue the command:

nano env/netbox.env

In that file, you might want to change the line:

SUPERUSER_PASSWORD=admin

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. 

Src: 
https://www.techrepublic.com/article/how-to-deploy-the-netbox-network-documentationmanagement-tool-with-docker/
https://github.com/netbox-community/netbox-docker

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.