An FTP server designed to simplify local development environments.
4.2K
vsftpd FTP Server for DockerNote on Security: This container has been developed primarily for local and development environments and should not be used in a production environment without rigorous security review and customisation.
This Docker image provides a vsftpd server, incorporating the following core features:
debian:bookworm-slim image.local_root) and associated system user
ID (FTP_UID).The pre-built image is available on Docker Hub at
alexs77/vsftpd.
This work is based on the foundation laid by
wildscamp/docker-vsftpd.
For reference, their Docker registry page is available at
wildscamp/vsftpd.
This image supports run-time configuration via standard environment variables.
VSFTPD_USER_[0-9]+These are compound variables that enable the addition of an arbitrary number of virtual FTP users.
<username>:<password>:<system_uid>:<ftp_root_dir>.<system_uid> and <ftp_root_dir>
parameters are optional, but the separating colons (:) must be
maintained. If the system user ID is omitted, it defaults to the
UID of the built-in ftp account (104). If the root directory
is omitted, it defaults to /home/virtual/<username>.VSFTPD_USER_1=hello:world:: - Creates an FTP user hello with
the password world. The system user's UID will default to
104, and the FTP root directory will be /home/virtual/hello.VSFTPD_USER_1=user1:docker:33: - Creates an FTP user user1
with the password docker. The system user's UID will be
33. If a system user with this ID already exists, the FTP
user will be mapped to it. The FTP root directory defaults to
/home/virtual/user1.VSFTPD_USER_1=mysql:mysql:999:/srv/ftp/mysql - Creates an FTP
user mysql with the password mysql. The system user's
UID is 999, and the FTP root directory is explicitly set to
/srv/ftp/mysql.ftp. It is therefore recommended to avoid using this
name when defining a virtual FTP user.allow_writeable_chroot=YES in the default user configuration.VSFTPD_CONF_*These variables allow you to set arbitrary vsftpd configuration options without modifying configuration files.
VSFTPD_CONF_
will be automatically converted to a vsftpd configuration
directive.VSFTPD_CONF_ is stripped, the
remaining name is converted to lowercase, and the result is
written to the vsftpd configuration file.VSFTPD_CONF variable (defaults to /etc/vsftpd/vsftpd.conf).VSFTPD_CONF_DUAL_LOG_ENABLE=YES - Sets dual_log_enable=YES in
the vsftpd configuration, enabling dual logging mode.VSFTPD_CONF_MAX_CLIENTS=50 - Sets max_clients=50, limiting the
maximum number of simultaneous clients.VSFTPD_CONF_IDLE_SESSION_TIMEOUT=600 - Sets
idle_session_timeout=600, terminating idle sessions after 10
minutes.VSFTPD_CONF_WRITE_ENABLE=NO - Sets write_enable=NO, creating a
read-only FTP server.Note: These settings are applied during container startup and will override any existing values in the configuration file.
VSFTPD_CONF/etc/vsftpd/vsftpd.confVSFTPD_CONF_* variables will write their settings. This allows
you to target a custom configuration file if needed.PASV_ADDRESSVSFTPD_CONF_PASV_ADDRESS for consistency with other
vsftpd settings.| Environment | IP | Comment |
|---|---|---|
| Docker for Windows | 10.0.75.1 | Default Hyper-V host IP |
| boot2docker | 192.168.99.100 | Default docker-machine IP |
PASV_MIN_PORT30000PASV_MAX_PORT.PASV_MAX_PORT30009PASV_MIN_PORT.The container exposes the following ports:
PASV_MIN_PORT and
PASV_MAX_PORT.Note: Active FTP mode is completely disabled. Port 20 is not exposed or used.
When running the container, ensure all necessary ports are published
to your host machine using the -p flag or in your
docker-compose.yaml.
For the FTP server to be useful, a minimum of one data volume should be mounted.
local_root=/home/virtual/user1 will require a volume
mount at /home/virtual/user1 inside the container./var/log/vsftpd.
It is recommended to mount this directory to retain logs outside
of the container lifecycle./etc/vsftpd/vusers/<username>. Global default settings can be
overridden by mounting a file to
/etc/vsftpd/default_user.conf.The vsftpd server writes log files to the /var/log/vsftpd
directory inside the container:
/var/log/vsftpd/vsftpd.log - Main vsftpd log file containing
FTP protocol commands, responses, and connection details (when
log_ftp_protocol=YES)/var/log/vsftpd/xferlog - File transfer log recording all
upload and download operationsTo persist logs on the host system and enable access outside the container, mount the log directory as a volume:
Content type
Image
Digest
sha256:f835b8f55…
Size
31.4 MB
Last updated
10 months ago
docker pull alexs77/vsftpd