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

Refused connection to FTP when using docker-compose instead of docker run

NixBiks opened this issue · comments

I have a docker-compose.yml looking like this

version: "3"
services: 
  ftpd_server:
    image: stilliard/pure-ftpd:hardened
    ports: 
      - "21"
      - "30000-30009"
    env_file: ftpd.env

with ftpd.env like this

PUBLICHOST=localhost
ADDED_FLAGS=-d -d

But then I get this error

❯ ftp -p localhost 21
ftp: connect: Connection refuse

If I use docker run then I can connect just fine

docker run -d --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "ADDED_FLAGS=-d -d" stilliard/pure-ftpd:hardened

Any idea why that is?

Hi @mr-bjerre

It might be worth checking the ports are mapping correctly, you can see this I believe in the output from docker-compose ps.

You might need to change them to:

    ports: 
      - "21:21"
      - "30000-30009:30000-30009"

Alternatively you could check the docker-compose logs output for the container.

Hope this helps.

Yeah just realized right now. You beat me to it though - damn quick reply. Thanks a bunch!

I do have another question though but maybe it's not the right place to ask though.

I've created a VM instance in Google Cloud using Container-Optimized OS. Then I run

docker run --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "ADDED_FLAGS=-d -d" -e FTP_USER_NAME=user -e FTP_USER_PASS=pass -e FTP_USER_HOME=/home/user stilliard/pure-ftpd:hardened

which starts the server. Then I connect from my local machine

ftp -p IP-ADDRESS 21

and enter the credentials. Everything is fine until now but when I try to put SOME-FILE then I get

ftp> put 56_17171_wc8964.xml 
local: 56_17171_wc8964.xml remote: 56_17171_wc8964.xml
227 Entering Passive Mode (127,0,0,1,117,56)
ftp: connect: Connection refused

Any idea? I've added firewall rules to allow connection on port 21 and 30000-30009

Hi @mr-bjerre are you still setting the publichost env variable?

To be honest I’m not exactly sure what that environment variable does. I’m tried setting it to localhost and to nothing

No worries, it's the host / ip address of where the pure-ftpd instance is.
It's needed for passive mode to work correctly.

Try setting it as the ip address you're connecting to, hope it helps.

You solved my misery! Thanks a lot! @stilliard