stilliard / docker-pure-ftpd

Docker Pure-ftpd Server

Home Page:https://hub.docker.com/r/stilliard/pure-ftpd/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection Refused errors when called within docker

cbroome opened this issue · comments

I'm really stuck on this one, and I hope someone may be able to help out. I'm trying to add a pure-ftpd instance to a larger docker project such that it can be accessed internally.

Here's my docker-compose for setting up the ftpd server.

ftps:
    image: stilliard/pure-ftpd
    ports:
      - "21000:21"
      - "30000-30009:30000-30009"
    volumes:
      - ftps_volume:/home/ftpusers
      - ftps_volume:/etc/ssl/private
      - ftps_volume:/etc/pure-ftpd/passwd/
      - ftps_volume:/var/log/pure-ftpd/
    environment:
      PUBLICHOST: "localhost"
      FTP_USER_NAME: ftps
      FTP_USER_PASS: ftps
      FTP_USER_HOME: /home/test-user
      ADDED_FLAGS: "--tls=2 -d"
      TLS_CN: "localhost"
      TLS_ORG: "TestOrg"
      TLS_C: "DE"
    restart: always
    networks:
      - test_build

Now this kinda works. I can run lftp -u ftps,ftps -p 21000 localhost and get into the launched pure-ftpd server, and PUT files to my heart's content.

When I try to access the server within the larger docker environment however, I'm getting Connection Refused errors immediately once I try to store a file. The code is able to connect, and login to the ftpd server. Right before storing a file the ftpd server will return a 211 status which I assume means its fine. Its just the action of storing the file that breaks.

While in the docker code I'm passing the ftps as the host as its in the docker network, all other localhost or 127.0.0.1 type hosts won't connect at all.

I'm using Kotlin and the org.apache.commons.net.ftp.* libraries to try to perform this operation.

Any help is greatly appreciated. Thanks.

Hi @cbroome
I think you'll need to change localhost for the PUBLICHOST env var to a specific ip in the docker network.

@stilliard that was it!

I changed PUBLICHOST: "localhost" to PUBLICHOST: "ftps" and it worked without issue. The best part was that lftp -u ftps,ftps -p 21000 localhost continues to work from the command line.

Thanks for this!

That's awesome!
Glad it worked well for you & thanks for the update too.