Skip to content

Network Automation

My journey with Network & Cloud Automation

Menu
  • Beginner
  • DevOps-NetDevOps
  • Network Automation
    • Docker
    • Python Libraries
      • NAPALM
      • Netmiko
      • Jinja2
      • Scrapli
      • Yang
  • Cloud Automation
    • Terraform
  • Python 🐍 Tips and Tricks
Menu
netbox docker

Netbox Docker Installation [Quick and Easy]

Posted on October 24, 2021March 31, 2023 by Gurpreet Kochar

There are a couple of ways you can install Netbox. The first one is a little time-consuming bare-bones method while the second one leverages docker and is just plug and play method. Let’s take a look at Netbox Docker installation method but If you aren’t familiar with Docker, here is a 5 part series that you can refer to for a better understanding of docker.

https://networkautomationlane.in/what-is-docker-for-network-engineers-part-i/

https://networkautomationlane.in/what-is-docker-for-network-engineers-part-ii/

https://networkautomationlane.in/what-is-docker-for-network-engineers-partiii/

https://networkautomationlane.in/what-is-docker-for-network-engineers-partiv/

https://networkautomationlane.in/docker-for-network-engineers-part-v-docker-compose/

  1. You can find more information about Netbox installation here
  2. For docker install method, please read below

Here is the public instance of Netbox that you can access to get the look and feel of the tool.

https://demo.netbox.dev/

Netbox Docker installation

  1. Download and install docker based upon your platform.
  2. Clone netbox docker git to a location on your system
git clone -b release https://github.com/netbox-community/netbox-docker.git
cd netbox-docker

3. Should you wish to hardcode the port at which netbox run’s on, we need to create a new file to do so otherwise nextbox will listen on a random port.

nano docker-compose.override.yml
version: '3.4'
services:
  netbox:
    ports:
      - 8000:8080

# 8000:8080 means port 8000 on your local machine is mapped to port 8080 of the docker container.
# You could change 8000 to any port that you want to access this docker container on.

4. This is how the directory structure will look like

╰─ tree -L 1                                                                                                                                                                                                                            ─╯
.
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ VERSION
β”œβ”€β”€ build-functions
β”œβ”€β”€ build-latest.sh
β”œβ”€β”€ build.sh
β”œβ”€β”€ configuration
β”œβ”€β”€ docker
β”œβ”€β”€ docker-compose.override.yml
β”œβ”€β”€ docker-compose.override.yml.example
β”œβ”€β”€ docker-compose.test.yml
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ env
β”œβ”€β”€ initializers
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ release.sh
β”œβ”€β”€ renovate.json
β”œβ”€β”€ reports
β”œβ”€β”€ requirements-container.txt
β”œβ”€β”€ scripts
β”œβ”€β”€ startup_scripts
└── test.sh

5. Make sure the docker engine is up and running before executing the below commands.

docker-compose pull
# This step might take a few minutes depending upon your internet bandwidth.
# It is in this step that docker will download all the dependencies required for Netbox to run as a container on your machine.

This is how the output of this command looks.

docker-compose pull netbox

6. Once it’s completed, execute the “docker-compose up” command to bring up the container and you should be able to access it once it’s up and running. Wait until the command stops producing any more output or you can see “Finished” on the screen at the bottom before the application is available to access via browser. You can also verify if the container is up and running using CLI “docker ps”.

or using GUI on the docker client.

7. Access the application on “http://0.0.0.0:8000/” on your web browser or whichever port that you specified in the YAML file above while creating the docker container. The default credentials to log in are “admin” “admin” and the default API key is “0123456789abcdef0123456789abcdef01234567” which you can otherwise get from by clicking on “Admin on top right corner > Profile and settings > API Token”

UPDATE:-

If admin/admin doesn’t work, you are required to create the first admin superuser by this command

To create the first admin user run this command:

docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser
https://github.com/netbox-community/netbox-docker/wiki/Getting-Started

Reference

https://github.com/netbox-community/netbox-docker/wiki/Getting-Started

How to update a netbox docker

https://github.com/netbox-community/netbox-docker/wiki/Updating

Know someone who may benefit? Share this:

  • Tweet
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to email a link to a friend (Opens in new window) Email
  • More
  • Click to print (Opens in new window) Print
  • Click to share on Reddit (Opens in new window) Reddit
  • Share on Tumblr
  • Pocket

Like this:

Like Loading...

Related

4 thoughts on “Netbox Docker Installation [Quick and Easy]”

  1. Michael Cooper says:
    March 29, 2023 at 10:55 PM

    Hello very nice article thanks, However I am not able to login in with admin – admin? Am I doing something wrong? Is it in the format of admin and passwd admin+api-token-here in the password field? Sorry for the stupid question.

    Thanks,

    Loading...
    Reply
    1. Gurpreet Kochar says:
      March 31, 2023 at 4:27 PM

      It seems, you are required to create the first admin user using this instruction. The instructions over the time probably changed. This github link has the updated instructions.

      https://github.com/netbox-community/netbox-docker/wiki/Getting-Started

      To create the first admin user run this command:
      docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser

      Loading...
      Reply
  2. rayk32 says:
    January 13, 2022 at 8:59 PM

    Where is your docker-compse up command?

    Loading...
    Reply
    1. Gurpreet Kochar says:
      January 13, 2022 at 9:59 PM

      docker-compose pull should have been followed by docker-compose up. Thank you for catching that… I have made the correction and updated the content….

      Loading...
      Reply

Leave a Reply to Gurpreet KocharCancel reply

All Blog Posts
My Resume

Upcoming Posts

Sorry - nothing planned yet!

Recent Posts

  • How to backup configuration to TFTP Server using Ansible – Part II
  • How to backup network devices using Ansible – Part I
  • Netmiko SSH Proxy/JumpServer
  • A short note on SASE
  • Understanding Ansible

Recent Comments

  1. Jack on Multithreading with Python for Network Engineers
  2. LifeCanvas on [Theory] Multithreading vs Multiprocessing vs AsyncIO
  3. Jasper Horng on Netmiko SSH Proxy/JumpServer
  4. asdfasdf on Python API Using FASTAPI – UPDATE – PUT – PATCH – Part V
  5. Gurpreet Kochar on Python Scrapli AsyncIO Usage

Archives

  • September 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
Topic Request / Suggestion
Loading
© 2025 Network Automation | Powered by Minimalist Blog WordPress Theme
 

Loading Comments...
 

    %d