How to configure vsftpd with docker

11.5k Views Asked by At

I have been trying to configure a simple ftp server using the following docker container:

https://hub.docker.com/r/fauria/vsftpd

I deploy the container on an amazon ec2 instance with ports open for 20 and 21.

my docker-compose is like this:

version: '3.6'
services:
    vsftpd:
    image: fauria/vsftpd
    environment:
      - FTP_USER=myuser
      - FTP_PASS=mYp4sS
    ports:
      - 20:20
      - 21:21
    volumes: 
      - /var/app/ftp:/home/vsftpd
      - /var/log/ftp:/var/log/vsftpd

when starting docker I do get the following log and then nothing:

vsftpd  |   *************************************************
vsftpd  |   *                                               *
vsftpd  |   *    Docker image: fauria/vsftpd                *
vsftpd  |   *    https://github.com/fauria/docker-vsftpd    *
vsftpd  |   *                                               *
vsftpd  |   *************************************************
vsftpd  | 
vsftpd  |   SERVER SETTINGS
vsftpd  |   ---------------
vsftpd  |   ? FTP User: myuser
vsftpd  |   ? FTP Password: mYp4sS
vsftpd  |   ? Log file: /var/log/vsftpd/vsftpd.log
vsftpd  |   ? Redirect vsftpd log to STDOUT: No.

But when I try a ftp connection either with filezilla or event the cli ftp I keep getting a ECONNREFUSED - Connection refused by server issue.

How can I make the ftp server accessible?

1

There are 1 best solutions below

0
On

the problem is at port declaration in your docker-compose file, if you see in the example in the github repository, the statement with ip address and port is used, not only the port like you did before.

'3.6'
services:
    vsftpd:
    image: fauria/vsftpd
    environment:
        - FTP_USER=myuser
        - FTP_PASS=mYp4sS
    ports:
        - 0.0.0.0:20:20
        - 0.0.0.0:21:21
    volumes: 
        - /var/app/ftp:/home/vsftpd
        - /var/log/ftp:/var/log/vsftpd

just in case look in the file