fauria / docker-vsftpd

🐳 vsftpd Docker image based on Centos 7. Supports passive mode and virtual users.
https://hub.docker.com/r/fauria/vsftpd/
Apache License 2.0
414 stars 341 forks source link

fauria/vsftpd

docker_logodocker_fauria_logo

Docker Pulls Docker Build Status

This Docker container implements a vsftpd server, with the following features:

Installation from Docker registry hub.

You can download the image with the following command:

docker pull fauria/vsftpd

Environment variables

This image uses environment variables to allow the configuration of some parameters at run time:















Exposed ports and volumes

The image exposes ports 20 and 21. Also, exports two volumes: /home/vsftpd, which contains users home directories, and /var/log/vsftpd, used to store logs.

When sharing a homes directory between the host and the container (/home/vsftpd) the owner user id and group id should be 14 and 50 respectively. This corresponds to ftp user and ftp group on the container, but may match something else on the host.

Use cases

1) Create a temporary container for testing purposes:

  docker run --rm fauria/vsftpd

2) Create a container in active mode using the default user account, with a binded data directory:

docker run -d -p 21:21 -v /my/data/directory:/home/vsftpd --name vsftpd fauria/vsftpd
# see logs for credentials:
docker logs vsftpd

3) Create a production container with a custom user account, binding a data directory and enabling both active and passive mode:

docker run -d -v /my/data/directory:/home/vsftpd \
-p 20:20 -p 21:21 -p 21100-21110:21100-21110 \
-e FTP_USER=myuser -e FTP_PASS=mypass \
-e PASV_ADDRESS=127.0.0.1 -e PASV_MIN_PORT=21100 -e PASV_MAX_PORT=21110 \
--name vsftpd --restart=always fauria/vsftpd

4) Manually add a new FTP user to an existing container:

docker exec -i -t vsftpd bash
mkdir /home/vsftpd/myuser
echo -e "myuser\nmypass" >> /etc/vsftpd/virtual_users.txt
/usr/bin/db_load -T -t hash -f /etc/vsftpd/virtual_users.txt /etc/vsftpd/virtual_users.db
exit
docker restart vsftpd