DHCP container on NCS5500 doesn´t up

Hi Team,
I want to create a DHCP container on NCS5500 cisco router but it doesn´t up.

Look, I have the image

[xr-vm_nodehost_CPU0:/]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
networkboot/dhcpd latest e25c872f0fca 2 years ago 139MB
[xr-vm_nodehost_CPU0:/]$

I created the dhcpd.conf file

[xr-vm_nodehost_CPU0:/usr/local/docker/dhcpd]$ ls
dhcpd.conf dhcpd.conf~
[xr-vm_nodehost_CPU0:/usr/local/docker/dhcpd]$

this is the information in dhcpd.conf file

[xr-vm_nodehost_CPU0:/usr/local/docker/dhcpd]$ vim dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.0.5, 192.168.0.6;
default-lease-time 43200;
max-lease-time 86400;
range 192.168.0.100 192.168.0.254;
}
~
~

I used this command to run the container

docker run -d --name dhcp-server --net=host --restart unless-stopped \

-v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf \

networkboot/dhcpd

My container is on Restarting, how can I up this container, can you help me, please?

[xr-vm_nodehost_CPU0:/]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES

cf9d657efa72        networkboot/dhcpd   "/entrypoint.sh"    54 seconds ago      Restarting (1) 1 second ago                       dhcp-server

regards
Analin

Remove -d to not daemonize and see output directly.

Hi Bluepuma77,

I did it but my container is in starting, can you help me to up it, please?

[xr-vm_nodehost_CPU0:/]$ docker run -d --name dhcp-server --net=host --restart unless-stopped \
  -v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf \
  networkboot/dhcpd
1d392e5fea92f10e2716bceb77d828018c7c2ffd2f3ee6ff2f33415292f13915
[xr-vm_nodehost_CPU0:/]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                                  PORTS               NAMES
1d392e5fea92        networkboot/dhcpd   "/entrypoint.sh"    4 seconds ago       Restarting (1) Less than a second ago                       dhcp-server

I edited your posts to add code blocks.


Please, format your posts next time according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

So you didn’t. But you don’t actually need to. Just use docker logs . Whe something is restarting it has a reason.

Could you share us the logs, and also check the volume binds have necessary permissions.

Eh wait , the path where your dhcpd.conf dhcpd.conf~ saved is /usr/local/docker/dhcpd and the path you have used in binds is /etc/dhcp/dhcpd.conf:

Did anyone actually read the image description of networkboot/dhcpd on Docker Hub?
https://hub.docker.com/r/networkboot/dhcpd

If you read the description, you should end up with something like this:

docker run -d --name dhcp-server --net=host --restart unless-stopped \
  -v /usr/local/docker/dhcpd:/data \
  networkboot/dhcpd
1 Like

Hi Meyay!

I did it, but it still in restarting

[xr-vm_nodehost_CPU0:/]$ docker run -d --name dhcp-server --net=host --restart unless-stopped \
>   -v /etc/dhcp/dhcpd:/data \
>   networkboot/dhcpd
093db150923e4ee40c41d8f3406345dcfd1158c1bd82b4a43bad21550fc0ab1e

[xr-vm_nodehost_CPU0:/]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                                  PORTS               NAMES
093db150923e        networkboot/dhcpd   "/entrypoint.sh"    4 seconds ago       Restarting (1) Less than a second ago                       dhcp-server

logs

[xr-vm_nodehost_CPU0:/]$ 
[xr-vm_nodehost_CPU0:/]$ docker logs 093db150923e 
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
[xr-vm_nodehost_CPU0:/]$ man dhcpd.conf
sh: man: command not found

Hi rimelek,

if I remove -d this message appears

[xr-vm_nodehost_CPU0:/]$ docker run --name dhcp-server --net=host --restart unless-stopped \
> -v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf \
> networkboot/dhcpd
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
[xr-vm_nodehost_CPU0:/]$ 

If I put -d, the container is in Restarting status

[xr-vm_nodehost_CPU0:/]$ docker run -d --name dhcp-server --net=host --restart unless-stopped \
> -v /etc/dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf \
> networkboot/dhcpd
12f03a562401ebc6515d71c53caf21509d3c9d649b96cd5fdc1f67c9385deedf
[xr-vm_nodehost_CPU0:/]$
[xr-vm_nodehost_CPU0:/]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                         PORTS               NAMES
12f03a562401        networkboot/dhcpd   "/entrypoint.sh"    20 seconds ago      Restarting (1) 6 seconds ago                       dhcp-server
[xr-vm_nodehost_CPU0:/]$ 

logs

[xr-vm_nodehost_CPU0:/]$ docker logs 12f03a562401
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.

Hi Salmanshariff171,

They are the logs:

[xr-vm_nodehost_CPU0:/]$ docker logs 12f03a562401
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.
Please ensure '/data' folder is available.
If you just want to keep your configuration in "data/", add -v "$(pwd)/data:/data" to the docker run command line.

regards
Analin

As I asked you before,


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

After fixing your post, please send a new comment so people are notified about the fixed content.


You have 24 hours to edit your posts until the edit option (pencil icon) disappears.

Sorry Rimelek, I edited it!

Thanks. Now all you need to do is read the error messages and what people suggest to you instead of trying to avoid following the instructions. I don’t think we can be clearer than the error messages that tell you exactly which folder is required in the container and even what command you need to use to do it right. Note that help will come only as long as people don’t think they waste their time and when you follow the instructions which doesn’t seem to be the case.

Maybe if you run it as an argument of the container as suggested by the logs and not on the host, you get something useful. @meyay shared the link to the description from which you can basically copy-paste the correct command.

I want to give you another chance so please, start describing your issue from the very beginning. Include the current path of your current configuration file and also the content of your current dhcp configuration. Then mount the config folder to /data as the error message suggests and as it was suggested by @meyay. Then share the current logs again.

If you change any other part of your config without explaning what you changed and why and just show us something we have no way to understand because it is not what you already shared before, I’m pretty sure the answers will stop coming and all we can do is whish you luck. So let’s try again.

ok, start describing the issue:

I want to up the container DHCP on router cisco NCS5500 but this is in restarting state.
I have tested two options:

Option 1:
The image of DHCP is on the device.

[xr-vm_nodehost_CPU0:/]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
networkboot/dhcpd   latest              e25c872f0fca        2 years ago         139MB

the file dhcpd.conf is on this path :

slight_smile: [xr-vm_nodehost_CPU0:/etc/dhcp]$ ls
dhcpd  dhcpd.conf  dhcpd.conf~  dockerfile  dockerfile~

The configuration inside dhcpd.conf file is the following:


default-lease-time 600;
max-lease-time 7200;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.10 192.168.1.100;
    option routers 192.168.1.1;
    option domain-name-servers 192.168.1.1;
}

I have run the command from @meyay

[xr-vm_nodehost_CPU0:/]$ docker run -d --name dhcp-server --net=host --restart unless-stopped \
>   -v /etc/dhcp/dhcpd:/data \
>   networkboot/dhcpd
fc599df8ac8537a6bda2702a915cda4f4b3d7702503e2545159d13805497adb8

The container is in Restarting status

[xr-vm_nodehost_CPU0:/]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                                  PORTS               NAMES
fc599df8ac85        networkboot/dhcpd   "/entrypoint.sh"    4 seconds ago       Restarting (1) Less than a second ago                       dhcp-server
[xr-vm_nodehost_CPU0:/]$ 

They are the logs of this container

[xr-vm_nodehost_CPU0:/]$ docker logs fc599df8ac85
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.
Please ensure '/data/dhcpd.conf' exists and is readable.
Run the container with arguments 'man dhcpd.conf' if you need help with creating the configuration.

In data folder are this files

[xr-vm_nodehost_CPU0:/]$ cd data
[xr-vm_nodehost_CPU0:/data]$ ls
dhcpd.conf  dhcpd.leases  dhcpd.leases~  images
[xr-vm_nodehost_CPU0:/data]$ 

thanks

Option 2:

I have followed the steps on Meyay´s link.

https://hub.docker.com/r/networkboot/dhcpd

1.- The folder data is created

[xr-vm_nodehost_CPU0:/]$ cd data
[xr-vm_nodehost_CPU0:/data]$ ls
dhcpd.conf  dhcpd.leases  dhcpd.leases~  images

2.-Inside data folder is dhcpd.conf

[xr-vm_nodehost_CPU0:/]$ cd data
[xr-vm_nodehost_CPU0:/data]$ ls
dhcpd.conf  dhcpd.leases  dhcpd.leases~  images

this is the information in dhcpd.conf

subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.0.5, 192.168.0.6;
default-lease-time 43200;
max-lease-time 86400;
range 192.168.0.100 192.168.0.254;
}

This is the step 3 in the link:

1. Run `docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd eth0`. `dhcpd` will automatically start and display its logs on the console. You can press Ctrl-C to terminate the server.

I did it:

[xr-vm_nodehost_CPU0:/]$ docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd eth0. dhcpd
/entrypoint.sh: line 71: exec: eth0.: not found

if I put the same command without the interface, I can see all the interfaces of my device are listening:

[xr-vm_nodehost_CPU0:/]$ docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd            
Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /data/dhcpd.conf
Database file: /data/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 0 leases to leases file.

No subnet declaration for br-ade2bb0dd030 (172.17.0.1).
** Ignoring requests on br-ade2bb0dd030.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface br-ade2bb0dd030 is attached. **


No subnet declaration for BE1002.20 (no IPv4 addresses).
** Ignoring requests on BE1002.20.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface BE1002.20 is attached. **


No subnet declaration for Lo116 (116.16.16.16).
** Ignoring requests on Lo116.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Lo116 is attached. **


No subnet declaration for Hu0_0_0_2 (no IPv4 addresses).
** Ignoring requests on Hu0_0_0_2.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Hu0_0_0_2 is attached. **


No subnet declaration for Hu0_0_0_4 (173.1.1.14).
** Ignoring requests on Hu0_0_0_4.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Hu0_0_0_4 is attached. **


No subnet declaration for Hu0_0_0_5 (173.1.1.17).
** Ignoring requests on Hu0_0_0_5.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Hu0_0_0_5 is attached. **


No subnet declaration for Hu0_0_0_10 (no IPv4 addresses).
** Ignoring requests on Hu0_0_0_10.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Hu0_0_0_10 is attached. **


No subnet declaration for Hu0_0_0_23 (no IPv4 addresses).
** Ignoring requests on Hu0_0_0_23.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Hu0_0_0_23 is attached. **


No subnet declaration for Hu0_0_0_0 (no IPv4 addresses).
** Ignoring requests on Hu0_0_0_0.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Hu0_0_0_0 is attached. **


No subnet declaration for BE1002 (no IPv4 addresses).
** Ignoring requests on BE1002.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface BE1002 is attached. **


No subnet declaration for Lo5 (192.168.1.2).
** Ignoring requests on Lo5.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Lo5 is attached. **


No subnet declaration for Lo0 (117.96.88.98).
** Ignoring requests on Lo0.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface Lo0 is attached. **


Not configured to listen on any interfaces!

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging.

According to my topology, I want to use the interface hun 0/0/0/5, attach the topology

But if I use this interface it doesn´t work

[xr-vm_nodehost_CPU0:/]$ docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd HundredGigE0/0/0/5. dhcpd
/entrypoint.sh: line 71: /HundredGigE0/0/0/5.: No such file or directory

What am I missing? The container wants the config file at a dedicated path, make sure you bind-mount the file to the correct path inside the container and it is readable per permissions.

Now the container is configured to actually reads the dhcp.conf file. Though it seems it is not configured properly and/or your interface has a different name inside the container.

Furthermore, the isc dhcp server embedded image is EOL, the image is 2 years old and has following vulnerabilities:

PS C:\Users\me> docker pull networkboot/dhcpd
Using default tag: latest
latest: Pulling from networkboot/dhcpd
d19f32bd9e41: Pull complete
1f23f0afd8a5: Pull complete
4928050fa1d6: Pull complete
7de3f1d09837: Pull complete
Digest: sha256:e99bbfbd6fb2f7e19fa4ce18aeebea02ab6377d6e909adc2b303a694edfb7219
Status: Downloaded newer image for networkboot/dhcpd:latest
docker.io/networkboot/dhcpd:latest

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview networkboot/dhcpd
PS C:\Users\metin> docker scout quickview networkboot/dhcpd
    i New version 1.15.0 available (installed version is 1.14.0) at https://github.com/docker/scout-cli
    v Image stored for indexing
    v Indexed 166 packages

    i Base image was auto-detected. To get more accurate results, build images with max-mode provenance attestations.
      Review docs.docker.com ↗ for more information.

  Target               │  networkboot/dhcpd:latest  │    0C     4H    45M    42L
    digest             │  e25c872f0fca              │
  Base image           │  ubuntu:22.04              │    0C     4H    44M    42L
  Refreshed base image │  ubuntu:22.04              │    0C     0H     3M    14L
                       │                            │           -4    -41    -28
  Updated base image   │  ubuntu:24.04              │    0C     0H     1M     4L
                       │                            │           -4    -43    -38

How do you expect to perform patch management on a product that reached EOL?

I strongly recommend to search for a different image (that uses a s different dhcp server implementation)!

Thanks for your help meyay,

But I can´t download the last version of DHCP.

I download de image

C:\Users\analisan>docker pull networkboot/dhcpd
Using default tag: latest
latest: Pulling from networkboot/dhcpd
Digest: sha256:e99bbfbd6fb2f7e19fa4ce18aeebea02ab6377d6e909adc2b303a694edfb7219
Status: Image is up to date for networkboot/dhcpd:latest
docker.io/networkboot/dhcpd:latest

But when I put this command docker scout quickview networkboot/dhcpd, the scout is not recognized

C:\Users\analisan>docker scout quickview networkboot/dhcpd
docker: 'scout' is not a docker command.
See 'docker --help'

I know it’s a lot to ask, but is it possible for you to download the image and share the link with me to download it?

thanks

I am confused about your takeaway from my post. It should have been: find something else, what you want to use is EOL and has known vulnerabilites.

This question confuses me.

I am bailing out of this topic. The original issue about how to start the container is solved.

The remaining question is how to configure the service that runs inside the container. You will need to learn how to configure and use it, the same way as you would need to do without containers.

Good luck!