1

i'm desperately trying to run tftp-hpa in a docker container. I built an image from dockerfile and start it with:

docker run -v /tmp:/srv/tftp -d -p 69:69/udp -t tftp_server

It's up and running and i can access the server via the virtual docker interface:

me@hostmachine$ tftp 172.17.0.79
tftp> get /srv/tftp/test
Received 7 bytes in 0.0 seconds

But from my opinion the -p 69:69/udp switch should forward the 69 port of my host machine to the containers port 69. But this does not seem to work:

me@hostmachine$ tftp localhost
tftp> get /srv/tftp/test
Transfer timed out.

From netstat, i see that port 69 on my hostmachine is open. I tried exactly the same scenario with an httpd server and port 80. It works here, i can access the website via 127.0.0.1:80 in my browser. The host machine is ubuntu 15.04 intel and the docker image is based on debian base image.

Can anybody help me? Is there something i could have missed? Any ideas how to debug? I will happily share my Dockerfile or any more information, but tried to keep question short.

Peter Power
  • 121
  • 3
  • 7
  • Is your problem something similar to this? http://serverfault.com/questions/599101/tftpd-allows-connections-but-times-out-transferring-a-file – Viswesn Jul 27 '15 at 17:57
  • make sure tfpt doesn't bind to localhost but all interfaces (0.0.0.0) – milan Jul 27 '15 at 22:48
  • @milan The tftp server is indeed bound to all interfaces.. Otherwise i would not be able to connect to its docker interface at 172.17.0.79. – Peter Power Jul 28 '15 at 07:05
  • @Viswesn no not really, he's running virtualbox and apparently the problem was with starting as service and standalone. I just checked my configuration and it's only started as standalone in foreground. I don't have anything else running (like xinetd) in my container – Peter Power Jul 28 '15 at 07:08

2 Answers2

1

Try to set your Docker container's network mode to "host".

i.e. 1) if you're running your container using "docker run" then append option "net=host" 2) if you're running using docker-compose, then under the tftp service definition block, add line "network-mode=host"

0

Are you using boot2docker? If yes, then make sure that UDP port forwarding is enabled in your VirtualBox configuration. For example on the Mac console:

for i in {10000..10999}; do
    VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
    VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";
done

In the past there were several boot2docker UDP issues reported.

Henrik Sachse
  • 51,228
  • 7
  • 46
  • 59
  • Thank you for your answer, but no the host machine is ubuntu 15.04 64 bit native without any virtualbox. This seems to be a common problem, but not for me :/ – Peter Power Jul 27 '15 at 17:16