# FTP route from nodejs ftp-srv

**URL:** <https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158>\
**Category:** Traefik v2\
**Tags:** tcp, docker\
**Created:** [March 24, 2021, 12:29pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158 "2021-03-24T12:29:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmesml](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gmesml/32/3584_2.png) [@gmesml](https://community.traefik.io/u/gmesml)\
**Post date:** [March 24, 2021, 12:29pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/1 "2021-03-24T12:29:11Z")

</div>

Hey everyone,

we're using traefik to rproxy resources on a cluster,  
and on one of the containers need to establish an FTP server,  
which works ok and can connect + upload files when running locally.  
The ftp server runs on nodejs [ftp-srv - npm](https://www.npmjs.com/package/ftp-srv)

We were able to list container on traefik dashboard at TCP tab but it ends marked with an error where it states: Router Details  
STATUS  
Error  
PROVIDER Docker  
RULE HostSNI(`*`)  
NAME ftp@docker  
SERVICE ftp-service  
ERRORS:  
entryPoint "other" doesn't exist  
no valid entryPoint for this router

The labels on the container Dockerfile for FTP are as follows:  
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="21"  
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65500"  
LABEL traefik.tcp.routers.ftp.service="ftp-service"  
LABEL traefik.tcp.routers.ftp.entrypoints="other"  
LABEL traefik.tcp.routers.ftp.rule="HostSNI(`*`)"

The FTP service is running and can see flow on console when running it on nodejs,  
this is the error comming from Filezilla FTP Client: 500 The given address is not yours (Error: Failed to retrieve directory listing).  
And this is the error occurring on nodejs console "SocketError: The given address is not yours.

As additional info, I'm running this on a domain I've dnsmasqed with 127.0.0.1 [domain.com](http://domain.com), so the docker container can be reached on that domain. any clue would be really helpful, thanks.

 ![Screenshot from 2021-03-24 13-31-35](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/4/49daf2c52be7f403e3000df737e63e70a00ba07f.png)

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [March 24, 2021, 12:50pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/2 "2021-03-24T12:50:19Z")

</div>

Hi @gmesml

Where is the definition of the endpoint other? Is it in a static configuration file that wasn't mounted correctly?

---

<div class="post-metadata">

**Author:** ![gmesml](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gmesml/32/3584_2.png) [@gmesml](https://community.traefik.io/u/gmesml)\
**Post date:** [March 24, 2021, 1:09pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/5 "2021-03-24T13:09:46Z")

</div>

We're building the images using this Dockerfile:

```auto
FROM node:14.16-alpine3.12
WORKDIR /usr/src/app
LABEL traefik.enable="true"
LABEL traefik.http.services.ftp.loadbalancer.server.port="3300"
LABEL traefik.http.routers.ftp.rule="PathPrefix(`/`, `/rest`)"
LABEL traefik.http.routers.ftp.priority="10"
LABEL traefik.http.routers.ftp.entrypoints="web"
LABEL traefik.http.routers.ftp.tls="false"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="21"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65500"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65501"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65502"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65503"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65504"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65505"
LABEL traefik.tcp.routers.ftp.service="ftp-service"
LABEL traefik.tcp.routers.ftp.entrypoints="other"
LABEL traefik.tcp.routers.ftp.rule="HostSNI(`*`)"
ENV NODE_ENV=development
EXPOSE 3300
EXPOSE 21/tcp
EXPOSE 65500-65505
CMD ["npm", "run" , "start:dev"]

```

then run a container like this:

```auto
docker run -it --network internal --name ftp -p 3300:3300 -p 21:21 -v "$(pwd)":/usr/src/app ftpimage

```

---

<div class="post-metadata">

**Author:** ![gmesml](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gmesml/32/3584_2.png) [@gmesml](https://community.traefik.io/u/gmesml)\
**Post date:** [March 24, 2021, 1:12pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/6 "2021-03-24T13:12:25Z")

</div>

I don't know where the definition of endpoint/entrypoint other is, though tried to replace it with ftp, am just assuming the endpoints are predefined.

I'm new to traefik and trying to understand how it does rproxy services.

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [March 24, 2021, 1:27pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/7 "2021-03-24T13:27:37Z")

</div>

You'll have to define the entrypoint in traefik's static configuration. The only default one is http on port 80 (checked on v2.4).

[https://doc.traefik.io/traefik/routing/entrypoints/](https://doc.traefik.io/traefik/routing/entrypoints/)

This won't work as you're expecting:

```auto
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="21"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65500"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65501"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65502"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65503"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65504"
LABEL traefik.tcp.services.ftp.loadbalancer.server.port="65505"

```

You're just redefining the same label over and over.

I'm pretty sure for this to even have a chance of working you will need an entrypoint,router and service for each passive port you are using as well as port 21 for each too. It will be a lot of labels.

/aside Why FTP ?

---

<div class="post-metadata">

**Author:** ![gmesml](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gmesml/32/3584_2.png) [@gmesml](https://community.traefik.io/u/gmesml)\
**Post date:** [March 24, 2021, 1:32pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/8 "2021-03-24T13:32:37Z")

</div>

I was following this github issue:

> <https://github.com/stilliard/docker-pure-ftpd/issues/98#issuecomment-760066744>
>
> Hi there. I'm trying to setup up this container to be used through Traefik. This is what I did.
> ftp-sgrio:
> image:...

On this Dockerfile I'm just adding trafeik labels for one of the containers which is this ftp,  
on the other hand on main traefik server I can see this definitions:

```auto
[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.websecure]
    address = ":443"

```

Would adding ftp here with port 21 solve the matter? (Going to try)  
I thought having indefinite labels would make no probs when it comes to trafeik reading labels from other docker containers ? Am I wrong?

When there's different systems being integrated there are some old software running on ftp and insecure protocols and trying to make some retrofit integration to modern software...

---

<div class="post-metadata">

**Author:** ![gmesml](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gmesml/32/3584_2.png) [@gmesml](https://community.traefik.io/u/gmesml)\
**Post date:** [March 24, 2021, 1:57pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/9 "2021-03-24T13:57:53Z")

</div>

Thanks a lot for the last sentence, it was quite instructive.

Digging the Traefik server configs I was able to open the route services on entrypoints,  
now I'm getting range error from FTP Server!  
`RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536.`

Indeed there need to be pairs for port service and entrypoint.

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [March 24, 2021, 2:36pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/10 "2021-03-24T14:36:15Z")

</div>

As you can see in the referenced issue, an entrypoint is created for each port:

```auto
      - --entrypoints.entrypoint-ftp.address=:21
      - --entrypoints.entrypoint-ftp-passive-0.address=:30000
      - --entrypoints.entrypoint-ftp-passive-1.address=:30001
      - --entrypoints.entrypoint-ftp-passive-2.address=:30002
      - --entrypoints.entrypoint-ftp-passive-3.address=:30003
      - --entrypoints.entrypoint-ftp-passive-4.address=:30004
      - --entrypoints.entrypoint-ftp-passive-5.address=:30005
      - --entrypoints.entrypoint-ftp-passive-6.address=:30006
      - --entrypoints.entrypoint-ftp-passive-7.address=:30007
      - --entrypoints.entrypoint-ftp-passive-8.address=:30008
      - --entrypoints.entrypoint-ftp-passive-9.address=:30009
      ...

```

And likewise in the router rules and services, note that each one has an incrementing value on the label.

```auto
- traefik.tcp.routers.router-ftp.entrypoints=entrypoint-ftp
      - traefik.tcp.routers.router-ftp.rule=HostSNI(`*`)
      - traefik.tcp.routers.router-ftp.service=service-ftp
    
      - traefik.tcp.routers.router-ftp-passive-0.entrypoints=entrypoint-ftp-passive-0
      - traefik.tcp.routers.router-ftp-passive-0.rule=HostSNI(`*`)
      - traefik.tcp.routers.router-ftp-passive-0.service=service-ftp-passive-0

      - traefik.tcp.routers.router-ftp-passive-1.entrypoints=entrypoint-ftp-passive-1
      - traefik.tcp.routers.router-ftp-passive-1.rule=HostSNI(`*`)
      - traefik.tcp.routers.router-ftp-passive-1.service=service-ftp-passive-1
...
...
...
  - traefik.tcp.services.service-ftp.loadbalancer.server.port=21

      - traefik.tcp.services.service-ftp-passive-0.loadbalancer.server.port=30000
      - traefik.tcp.services.service-ftp-passive-1.loadbalancer.server.port=30001
      - traefik.tcp.services.service-ftp-passive-2.loadbalancer.server.port=30002
...

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [March 27, 2021, 2:36pm UTC](https://community.traefik.io/t/ftp-route-from-nodejs-ftp-srv/10158/11 "2021-03-27T14:36:50Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
