Closed chtbof closed 6 years ago
I didn't work with docker yet, but maybe this repo will help you https://github.com/Noctua36/docker-node-snap7
To bind with port numbers less than 1024, you have to run the container in privileged mode (docker run -p102:102 --privileged
), or, recommended, just add this capability to it (docker run -p102:102 --cap-add=NET_BIND_SERVICE
)
@Noctua36 Thanks for the help :) If the port is the problem, then there are also the possibilities to change the server port with S7Server.SetParam()
or if you run a kernel >4.11 you can set --sysctl net.ipv4.ip_unprivileged_port_start=0
as a docker parameter to disable privileged ports.
@chtbof Did this solve your issue?
Not really. But using as server is just for testing. I am using node-snap7 for record datalog to sql server. The node-snap7 working great.
I start my dev-server usually on a Port > 1024 to avoid bind restrictions in userspace
const s7server = new snap7.S7Server();
s7server.SetParam(s7server.LocalPort, 9102);
How use server function in docker. It run ok in docker but can't be connected. s7server.StartTo('127.0.0.1'); docker run -p 102:102 not work