Docker Community Forums

Share and learn in the Docker community.

Setting up network boot in docker container

I am trying to setup docker container which would support network booting beaglebone black.
I am using Ubuntu Xenial and supervisord to run isc-dhscp-server, nfs-kernel-server and tftpd-hpa.

I have this code on github at following link

Just to allow people to read full problem here itself, I am putting files here,
following is my docker file

FROM ubuntu:xenial
    # silence Dialog TERM not set errors in apt-get install
    ENV DEBIAN_FRONTEND noninteractive

    # factory requirements plus a couple of useful things
    RUN apt-get update && apt-get install -y \
        bzip2 \
        unzip \
        vim \
        wget \
        zip \
        bc \
        libsqlite3-dev \
        curl \
        net-tools \
        xinetd \
        tftpd-hpa \
        isc-dhcp-server \
        minicom \
        netbase \
        nfs-kernel-server \
        supervisor

    RUN mkdir -p /var/log/supervisor
    # Use bash, not dash
    RUN echo "dash dash/sh boolean false" | debconf-set-selections
    RUN dpkg-reconfigure dash

    COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
    COPY ./exports /etc/exports
    COPY ./isc-dhcp-server /etc/default/isc-dhcp-server
    COPY ./dhcpd.conf /etc/dhcp/dhcpd.conf
    COPY ./tftpd-hpa /etc/default/tftpd-hap
    COPY ./tftp /etc/xinetd.d/tftp

    EXPOSE 111/udp 2049/tcp

    RUN mkdir -p /nfsboot
    RUN mkdir -p /tftpboot
    VOLUME /workdir
    WORKDIR /workdir

    COPY entrypoint.sh /workdir

    CMD ["/workdir/entrypoint.sh"]

configuration files which are being copied as follows,

1 supervisord.conf

[supervisord]
nodaemon=true

[program:rpcbind]
command=/sbin/rpcbind

[program:isc-dhcp-server]
command=/bin/bash -c "service isc-dhcp-server start"

[program:nfs-kernel-server]
command=/bin/bash -c "service nfs-kernel-server start"

[program:xinetd]
command=/bin/bash -c "service xinetd start"

[program:tftpd-hpa ]
command=/bin/bash -c "service tftpd-hpa start"

2 exports

/nfsboot *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)

3 isc-dhcp-server

# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"

4 tftpd-hpa

# /etc/default/tftpd-hpa

TFTP_USERNAME="root"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-c --secure"

5 tftp which goes to etc/xinet.d/

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -c -s /tftpboot
disable = no
per_source = 11
cos = 100 2
}

6 entrypoint.sh

#!/bin/sh

/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &

/bin/sh

Now with this files I built docker image using following command

docker build -f networkboot.dockerfile -t bbb_networkboot

And used following command to run docker container.

docker run -it --net host --privileged bbb_networkboot

On running above command I see following logs

sh-4.3# 2019-03-26 13:34:31,574 CRIT Supervisor running as root (no user in config file)
2019-03-26 13:34:31,576 INFO supervisord started with pid 8
2019-03-26 13:34:32,579 INFO spawned: 'isc-dhcp-server' with pid 12
2019-03-26 13:34:32,581 INFO spawned: 'nfs-kernel-server' with pid 13
2019-03-26 13:34:32,583 INFO spawned: 'rpcbind' with pid 14
2019-03-26 13:34:32,585 INFO spawned: 'xinetd' with pid 15
2019-03-26 13:34:32,587 INFO spawned: 'tftpd-hpa' with pid 17
2019-03-26 13:34:32,665 INFO exited: rpcbind (exit status 0; not expected)
2019-03-26 13:34:32,709 INFO exited: xinetd (exit status 0; not expected)
2019-03-26 13:34:32,741 INFO exited: tftpd-hpa (exit status 0; not expected)
2019-03-26 13:34:32,747 INFO exited: isc-dhcp-server (exit status 1; not expected)
2019-03-26 13:34:32,846 INFO exited: nfs-kernel-server (exit status 0; not expected)
2019-03-26 13:34:33,849 INFO spawned: 'isc-dhcp-server' with pid 82
2019-03-26 13:34:33,851 INFO spawned: 'nfs-kernel-server' with pid 83
2019-03-26 13:34:33,853 INFO spawned: 'rpcbind' with pid 84
2019-03-26 13:34:33,855 INFO spawned: 'xinetd' with pid 85
2019-03-26 13:34:33,857 INFO spawned: 'tftpd-hpa' with pid 86
2019-03-26 13:34:33,863 INFO exited: rpcbind (exit status 1; not expected)
2019-03-26 13:34:33,899 INFO exited: isc-dhcp-server (exit status 1; not expected)
2019-03-26 13:34:33,907 INFO exited: tftpd-hpa (exit status 0; not expected)
2019-03-26 13:34:33,917 INFO exited: xinetd (exit status 0; not expected)
2019-03-26 13:34:33,946 INFO exited: nfs-kernel-server (exit status 0; not expected)
2019-03-26 13:34:35,950 INFO spawned: 'isc-dhcp-server' with pid 145
2019-03-26 13:34:35,952 INFO spawned: 'nfs-kernel-server' with pid 146
2019-03-26 13:34:35,954 INFO spawned: 'rpcbind' with pid 147
2019-03-26 13:34:35,957 INFO spawned: 'xinetd' with pid 148
2019-03-26 13:34:35,959 INFO spawned: 'tftpd-hpa' with pid 149
2019-03-26 13:34:35,966 INFO exited: rpcbind (exit status 1; not expected)
2019-03-26 13:34:36,003 INFO exited: isc-dhcp-server (exit status 1; not expected)
2019-03-26 13:34:36,009 INFO exited: tftpd-hpa (exit status 0; not expected)
2019-03-26 13:34:36,019 INFO exited: xinetd (exit status 0; not expected)
2019-03-26 13:34:36,046 INFO exited: nfs-kernel-server (exit status 0; not expected)
2019-03-26 13:34:39,052 INFO spawned: 'isc-dhcp-server' with pid 208
2019-03-26 13:34:39,054 INFO spawned: 'nfs-kernel-server' with pid 209
2019-03-26 13:34:39,056 INFO spawned: 'rpcbind' with pid 210
2019-03-26 13:34:39,058 INFO spawned: 'xinetd' with pid 211
2019-03-26 13:34:39,061 INFO spawned: 'tftpd-hpa' with pid 212
2019-03-26 13:34:39,071 INFO exited: rpcbind (exit status 1; not expected)
2019-03-26 13:34:39,097 INFO gave up: rpcbind entered FATAL state, too many start retries too quickly
2019-03-26 13:34:39,098 INFO exited: isc-dhcp-server (exit status 1; not expected)
2019-03-26 13:34:39,099 INFO gave up: isc-dhcp-server entered FATAL state, too many start retries too quickly
2019-03-26 13:34:39,111 INFO exited: tftpd-hpa (exit status 0; not expected)
2019-03-26 13:34:39,119 INFO gave up: tftpd-hpa entered FATAL state, too many start retries too quickly
2019-03-26 13:34:39,120 INFO exited: xinetd (exit status 0; not expected)
2019-03-26 13:34:39,151 INFO gave up: xinetd entered FATAL state, too many start retries too quickly
2019-03-26 13:34:39,151 INFO exited: nfs-kernel-server (exit status 0; not expected)
2019-03-26 13:34:40,152 INFO gave up: nfs-kernel-server entered FATAL state, too many start retries too quickly

following processes are running
sh-4.3# ps -el
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 1 0 0 80 0 - 4506 wait pts/0 00:00:00 entrypoint.sh
4 S 0 8 1 0 80 0 - 11827 poll_s pts/0 00:00:00 supervisord
0 S 0 9 1 0 80 0 - 4555 wait pts/0 00:00:00 sh
5 S 0 41 1 0 80 0 - 11906 poll_s ? 00:00:00 rpcbind
1 S 0 74 1 0 80 0 - 3795 poll_s ? 00:00:00 in.tftpd
1 S 0 80 1 0 80 0 - 22759 poll_s ? 00:00:00 rpc.mountd
5 S 0 81 1 0 80 0 - 3764 poll_s ? 00:00:00 xinetd
0 R 0 273 9 0 80 0 - 6494 - pts/0 00:00:00 ps

dhcp server is not running and nfs-kernel-server also not running,

can someone point me what could be wrong ? any suggestion to make it work.