Skip to content

zerosuxx/docker-alpine-ftp-server

 
 

Repository files navigation

docker-alpine-ftp-server

Docker Stars Docker Pulls Docker Image CI

Usage with docker

$ docker run -d \
    -p 21:21 \
    -p 21000-21010:21000-21010 \
    -e USERS='[{"name":"one","password":1234}]" \
    -e ADDRESS=ftp.site.domain \
    zerosuxx/alpine-ftp-server

Usage with docker-compose

$ docker-compose up

Configuration

Environment variables:

  • USERS - json object array (optional, default: [{"name":"alpineftp","password":"alpineftp"}])
    • examples [{"name":"name1","password":"password1","folder":"/folder1","group":"group1","uid":1001,"gid":1001},{"name":"name2","password":"password2"}]
  • VSFTPD_* - vsftp config property (example: VSFTPD_ANONYMOUS_ENABLE=NO writed into config file as anonymous_enable=NO)
  • CONFIGURE_WITH_ENV_VARS - disable to use original vsftp config file (default: 1)

Enable chroot

  • VSFTPD_CHROOT_LOCAL_USER=YES
  • VSFTPD_ALLOW_WRITEABLE_CHROOT=YES [optinal]

Enable passive mode

  • VSFTPD_PASV_ENABLE=YES
  • VSFTPD_PASV_MIN_PORT=21000
  • VSFTPD_PASV_MAX_PORT=21010
  • VSFTPD_PASV_ADDR_RESOLVE=YES [optinal]
  • VSFTPD_PASV_ADDRESS=ftpserver.local [optinal]

FTPS (File Transfer Protocol + SSL) Example

Issue free Let's Encrypt certificate and use it with alpine-ftp-server.

$ mkdir -p /etc/letsencrypt
$ docker run -it --rm \
    -p 80:80 \
    -v "/etc/letsencrypt:/etc/letsencrypt" \
    certbot/certbot certonly \
    --standalone \
    --preferred-challenges http \
    -n --agree-tos \
    --email [email protected]
    -d ftp.site.domain
$ docker run -d \
    --name ftp \
    -p 21:21 \
    -p 21000-21010:21000-21010 \
    -e ADDRESS=ftp.site.domain \
    -e TLS_CERT="/etc/letsencrypt/live/ftp.site.domain/fullchain.pem" \
    -e TLS_KEY="/etc/letsencrypt/live/ftp.site.domain/privkey.pem" \
    zerosuxx/alpine-ftp-server
  • Do not forget to replace ftp.site.domain with actual domain pointing to your server's IP.
  • Be sure you have avalible port 80 for standalone mode of certbot to issue certificate.
  • Do not forget to renew certificate in 3 month with certbot renew command.

About

Small and flexible docker image with vsftpd server

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 73.0%
  • Dockerfile 27.0%