Netbox image checking for SECRET_KEY during build #9193

Closed
opened 2025-12-29 20:46:49 +01:00 by adam · 1 comment
Owner

Originally created by @erikastr on GitHub (Feb 5, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.1

Python Version

3.11

Steps to Reproduce

  1. Create a Dockerfile with collectstatic step
FROM netboxcommunity/netbox:v3.6.6
RUN /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
  1. Run docker build .

Expected Behavior

Static files get collected

Observed Behavior

ImproperlyConfigured exception gets raised

0.226   File "/opt/netbox/netbox/netbox/settings.py", line 76, in <module>
0.226     raise ImproperlyConfigured(
0.226 django.core.exceptions.ImproperlyConfigured: SECRET_KEY must be at least 50 characters in length. To generate a suitable key, run the following command:
0.226   python /opt/netbox/netbox/generate_secret_key.py
------
Dockerfile:2
--------------------
   1 |     FROM netboxcommunity/netbox:v3.7.1
   2 | >>> RUN /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
   3 |
--------------------
ERROR: failed to solve: process "/bin/sh -c /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input" did not complete successfully: exit code: 1
Originally created by @erikastr on GitHub (Feb 5, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.1 ### Python Version 3.11 ### Steps to Reproduce 1. Create a Dockerfile with `collectstatic` step ``` FROM netboxcommunity/netbox:v3.6.6 RUN /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input ``` 2. Run `docker build .` ### Expected Behavior Static files get collected ### Observed Behavior `ImproperlyConfigured` exception gets raised ``` 0.226 File "/opt/netbox/netbox/netbox/settings.py", line 76, in <module> 0.226 raise ImproperlyConfigured( 0.226 django.core.exceptions.ImproperlyConfigured: SECRET_KEY must be at least 50 characters in length. To generate a suitable key, run the following command: 0.226 python /opt/netbox/netbox/generate_secret_key.py ------ Dockerfile:2 -------------------- 1 | FROM netboxcommunity/netbox:v3.7.1 2 | >>> RUN /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input 3 | -------------------- ERROR: failed to solve: process "/bin/sh -c /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input" did not complete successfully: exit code: 1 ```
adam closed this issue 2025-12-29 20:46:49 +01:00
Author
Owner

@erikastr commented on GitHub (Feb 5, 2024):

Apologies, looks like netbox-community/netbox-docker repo might be a better fit for this issue. Will move it there.

@erikastr commented on GitHub (Feb 5, 2024): Apologies, looks like [netbox-community/netbox-docker](https://github.com/netbox-community/netbox-docker) repo might be a better fit for this issue. Will move it there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9193