garethflowers / docker-ftp-server

A simple FTP server, using `vsftpd`.
https://garethflowers.dev/docker-ftp-server/
MIT License
192 stars 52 forks source link

227 Entering Passive Mode (0,0,0,0,156,64). #88

Open AnhDai1997 opened 7 months ago

AnhDai1997 commented 7 months ago

i create ftp server with this docker compose: services: ftp-server: container_name: ftp-server environment:

but get error when try login from windows Screenshot 2024-04-12 154656

this ftp server log: Screenshot 2024-04-12 154439

how to fix this?

galiullinis commented 6 months ago

Hi! Mount your own vsftpd.conf file:

volumes:
 - './data:/home/anhdai'
 - './vsftpd.conf:/etc/vsftpd.conf'

where you can change the next few params:

pasv_address= pasv_addr_resolve=NO

cause your FTP server tells to your PC FTP client to connect to 0.0.0.0 so why you need to specify correct external IP address

poliyka commented 4 months ago

Hi! Mount your own vsftpd.conf file:

volumes:
 - './data:/home/anhdai'
 - './vsftpd.conf:/etc/vsftpd.conf'

where you can change the next few params:

pasv_address= pasv_addr_resolve=NO

cause your FTP server tells to your PC FTP client to connect to 0.0.0.0 so why you need to specify correct external IP address

I tried it, but it gets stuck in the 'compose up' process and returns exit code 2. Therefore, I customized a Dockerfile to copy it into the container again like this:

# docker-compose.yaml
services:
  ftp-server:
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - FTP_PASS=pass
      - FTP_USER=user
    ports:
      - '20-21:20-21/tcp'
      - '40000-40009:40000-40009/tcp' # Only needed for passive mode
    volumes:
      - './data:/home/user'
    network_mode: "bridge"
# Dockerfile
FROM garethflowers/ftp-server

COPY [ "./vsftpd.conf", "/etc" ]

And it work!

I also recommend that these two environments be set up in a Compose environment for better management.