[LINUX] Tftp server with Docker

Introduction

Build a tftp server with Docker. I'm not doing anything special.

Target device and environment

Verification environment

Work content

Allow port with firewall

Allow the service to listen for the tftp service

firewall-cmd --add-service=tftp --zone=public --permanent
firewall-cmd --reload

Docker image preparation

Create an image so that it can be reused. Create an appropriate directory to put the Dockerfile and the configuration file.

mkdir -p /opt/docker/tftp
cd /opt/docker/tftp

Create a Dockerfile

/opt/docker/tftp/tftp.df


FROM centos:centos8
RUN dnf -y update ; dnf -y install tftp-server xinetd
COPY tftp /etc/xinetd.d/tftp
CMD [ "/usr/sbin/init" ]

xinetd settings

Create a configuration file to start tftp via xinetd

/opt/docker/tftp/tftp


service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -c -u root -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

Build an image from a Dockerfile to create a container

Once you have created the Dockerfile, build it. tftp first connects with 69 / udp, but after that it negotiates the port number and transfers data, so it is difficult to forward port with bridge. So it connects to the host network.

docker build --force-rm -t infraserv:tftp . -f ./tftp.df && \
docker run --cap-add sys_admin --security-opt seccomp:unconfined  -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
  --network host -it -d --name tftp --hostname tftp   infraserv:tftp

Operation check

Check with the Cisco router you had

Rdc01#copy run tftp://10.254.10.251/rdc01-config
Address or name of remote host [10.254.10.251]?
Destination filename [rdc01-config]?
!!
11944 bytes copied in 1.112 secs (10741 bytes/sec)

Rdc01#copy tftp://10.254.10.251/rdc01-config flash:
Destination filename [rdc01-config]?
Accessing tftp://10.254.10.251/rdc01-config...
Loading rdc01-config from 10.254.10.251 (via Vlan10): !
[OK - 11944 bytes]

11944 bytes copied in 0.652 secs (18319 bytes/sec)

Rdc01#

Recommended Posts

Tftp server with Docker
Proxy server with Docker
Creating a Flask server with Docker
Set up a Samba server with Docker
Start a simple Python web server with Docker
Use python with docker
Hello, World with Docker
Local server with python
I made a ready-to-use syslog server with Play with Docker
Implement PyTorch + GPU with Docker
PySpark life starting with Docker
Prepare python3 environment with Docker
Easy HTTP server with Python
Try Selenium Grid with Docker
Server management with Jupyter (1) import
Try building JupyterHub with Docker
Rails application building with Docker
Japaneseize Matplotlib with Alpine using Docker
Until you start Jupyter with Docker
Easy Slackbot with Docker and Errbot
Build a deb file with Docker
Tips for running Go with docker
Persist Flask API server with forever
Build Mysql + Python environment with docker
Deploy a Django application with Docker
Initialize Softether VPN server with GUI
Google App Engine development with Docker
Server construction with CONOHA VPS (CentOS)
Build PyPy execution environment with Docker
Make compute server diskless with LTSP
VPN server construction with Raspberry Pi
Service mesh learned with Docker Swarm
Rebuild Django's development environment with Docker! !! !! !!
Data science environment construction with Docker
Application development with Docker + Python + Flask
Build a CentOS Linux 8 environment with Docker and start Apache HTTP Server
Access the Docker Remote API with Requests
Run the IDCF cloud CLI with Docker
Build Jupyter Lab (Python) environment with Docker
[In-Database Python Analysis Tutorial with SQL Server 2017]
Behind the flyer: Using Docker with Python
Web server for browser testing with Mocha
Create your own DNS server with Twisted
Check out how Docker works with bpftrace
Dockerfile for RESTful MeCab server with mecab-ipadic-neologd
Django + Apache with mod_wsgi on Windows Server 2016
Build CGI Server running on Python 3 on Docker
Let's try gRPC with Go and Docker
Connect to MySQL with Python within Docker
Get a local DynamoDB environment with Docker
Let's scrape a dynamic site with Docker
Use cryptography library cryptography with Docker Python image
Create Python + uWSGI + Nginx environment with Docker
Make PLEN Control Server compatible with ViVi PLEN2
Dockerfile: Install Docker on your Linux server
[Linux] Build a jenkins environment with Docker
Send files via bastion server with scp
Launch environment with LineBot + Heroku + Docker + Python
[Golang] Create docker image with Github Actions
Run a Python web application with Docker
Create a web service with Docker + Flask