Closed CMALG closed 2 years ago
no i never run it in swarm mode. it was for me for some local stuff. but i checked if i could run it on a vps. but i have just a docker-rootless instance (still no swarm). there i could run it but only on a custom port 6969 (i think only ports >1024 are working without to add some capabilities).
here is my stack config:
services:
tftp-hpa:
container_name: tftp-hpa
image: 3x3cut0r/tftpd-hpa
restart: unless-stopped
ports:
- "6969:69/udp"
networks:
tftp-hpa:
ipv4_address: 10.24.69.69
dns:
- 8.8.8.8
- 8.8.4.4
- 2001:4860:4860::8888
- 2001:4860:4860::8844
environment:
TZ: "Europe/Berlin"
CREATE: 1
volumes:
- tftp-hpa-data:/tftpboot
networks:
tftp-hpa:
name: tftp-hpa
ipam:
driver: default
config:
- subnet: "10.24.69.0/24"
gateway: 10.24.69.1
volumes:
tftp-hpa-data:
name: tftp-hpa-data
do you need to use port 69 for some reason? then i think you need to add some capabilities? see here: https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
try to add "--cap-add=ALL" to check if it is working. and then reduce it to the needed one. most likely "--cap-add=NET_BIND_SERVICE"
for a stack: https://docs.docker.com/compose/compose-file/compose-file-v3/#cap_add-cap_drop
cap_add:
- ALL
i hope this can help
Thank you very much for the ideas unfortunately same outcome can't write files as soon as i deploy in stack on the same volumes. Even with cap_add all it will not work. But since nobody has any issues it might have something to do with my raspberrys. Who knows.
After some googling i found the problem (and solution) of your issue here: https://www.linuxquestions.org/questions/linux-server-73/tftp-connection-problem-626077/
and after looking deeper into other tftp-hpa docker images i found that you need to load netfilter modules and add helpers to track connections on your host machine:
sudo modprobe nf_conntrack_tftp
sudo modprobe nf_nat_tftp
can u try this and let us know if it helps
Thanks man but unfortunately still the same.
Checked that the modules are in fact activated on both manager and node.
ubuntu@Manager-1:~$ find /lib/modules/$(uname -r) | grep tftp
/lib/modules/5.15.0-1013-raspi/kernel/net/netfilter/nf_conntrack_tftp.ko
/lib/modules/5.15.0-1013-raspi/kernel/net/netfilter/nf_nat_tftp.ko
same error message
INFO: /usr/sbin/in.tftpd --foreground --address 0.0.0.0:69 --user tftp --create --port-range 4096:32760 --map-file /mapfile --secure --verbose --verbosity 3 /tftpboot
Aug 16 11:03:31 2b74865b4caa daemon.info in.tftpd[2959]: remap: input: test.txt
Aug 16 10:28:17 2b74865b4caa syslog.info syslogd started: BusyBox v1.34.1
Aug 16 11:03:31 2b74865b4caa daemon.info in.tftpd[2959]: remap: rule 6: rewrite: /test.txt
Aug 16 11:03:31 2b74865b4caa daemon.info in.tftpd[2959]: remap: done
Aug 16 11:03:31 2b74865b4caa daemon.notice in.tftpd[2959]: WRQ from 10.0.0.3 filename test.txt remapped to /test.txt
Aug 16 11:03:31 2b74865b4caa daemon.warn in.tftpd[2959]: tftpd: write(ack): Operation not permitted
What you did with your find
command is to check if the libraries are installed and not if there are loaded.
please check it with
lsmod | grep ftp
the outcome should be something like that:
nf_nat_tftp 16384 0
nf_conntrack_tftp 20480 1 nf_nat_tftp
nf_nat 57344 5 xt_nat,nf_nat_tftp,nft_chain_nat,iptable_nat,xt_MASQUERADE
nf_conntrack 176128 7 xt_conntrack,nf_nat,nf_conntrack_tftp,xt_nat,nf_nat_tftp,nf_conntrack_netlink,xt_MASQUERADE
as i said, activate them with:
sudo modprobe nf_conntrack_tftp
sudo modprobe nf_nat_tftp
sorry should have been more clear, i checked if they are present and activated them.
ubuntu@Node-1:~$ lsmod | grep ftp
nf_nat_tftp 16384 0
nf_conntrack_tftp 20480 1 nf_nat_tftp
nf_nat 49152 5 xt_nat,nf_nat_tftp,nft_chain_nat,xt_MASQUERADE,xt_REDIRECT
nf_conntrack 184320 10 xt_conntrack,nf_nat,nf_conntrack_tftp,xt_state,xt_nat,nf_nat_tftp,nf_conntrack_netlink,xt_MASQUERADE,ip_vs,xt_REDIRECT
Ok. Please don't feel sold for stupid, but i also just want to be sure.
So i will close the issue again. But feel free to open it again or contact me if you have any ideas.
No no was my fault for not being clear what i did.
I did some more testing and to my surprise it seems like a docker bug maybe ?
This does start and work
docker service create \
--mode global \
--publish mode=host,target=69,published=69,protocol=udp \
--name=tftp \
-e TZ="Europe/Berlin" \
-e CREATE=1 \
3x3cut0r/tftpd-hpa:latest
If you change publish mode to ingress the containers are stuck in "new" and will never start, waited hours....
docker service create \
--mode global \
--publish mode=ingress,target=69,published=69,protocol=udp \
--name=tftphost \
-e TZ="Europe/Berlin" \
-e CREATE=1 \
3x3cut0r/tftpd-hpa:latest
For some reason if you run the container with an ingress overlay network of any kind it does not work.
Seems more of a docker issue, i close this if i ever get it working i will let you know :D
Hi first thanks for providing the container it's exactly what i was looking for :) But i have some strange issues with it.
If i run this i have 0 issues:
But since i want to run it as a stack using you compose file as a base configuration:
I get "Operation not permitted".
I see no reason why it should not work but it does not for some strange reason. so my question have you ever tried to run it in a stack on docker swarm ? If not you can close the issue it is a long shot because i'm completely out of ideas....