lftp - Sophisticated ftp/http client
3.8K
Minimal Docker image that provides lftp as the main container process.
The image is configured to start lftp via ENTRYPOINT:
| Platform | Link |
|---|---|
| lftp | |
| nmeyer99/lftp |
For security reasons, lftp should not run as root inside a container. By default, many container processes run as root, which poses a high risk. If a vulnerability is exploited, an attacker could gain full control over the host server.
By starting the lftp process as a non-root user, you significantly limit the potential damage in case of an attack. The attacker would only have the restricted privileges of that user and couldn't access or manipulate the underlying host system.
While containers offer good isolation, they are not immune to attacks. Key security practices include:
To avoid permission issues with bind mounts, you can build the image so that the lftp user inside the container uses the same UID/GID as your host user.
docker build --build-arg LFTP_UID=$(id -u) --build-arg LFTP_GID=$(id -g) -t lftp:latest .LFTP_UID=100, LFTP_GID=101.Note: The container still runs as lftp (not root).
apk upgrade during buildYou can opt-in to upgrading all base packages during build via a build arg:
docker build --build-arg APK_UPGRADE=true -t lftp:latest .APK_UPGRADE=false (no upgrade for reproducibility)The Dockerfile conditionally runs apk update && apk --no-cache upgrade before installing required packages.
You can set the image metadata version label via a build arg:
docker build --build-arg IMAGE_VERSION=$(git describe --tags --always --dirty) -t lftp:latest .docker build --build-arg IMAGE_VERSION=$(git rev-parse --short HEAD) -t lftp:latest .This value is written to label org.opencontainers.image.version.
The image also writes the version into a file inside the container for easy runtime inspection:
/etc/image-versioncat /etc/image-versionThis mirrors the IMAGE_VERSION build arg and stays immutable at runtime.
ENTRYPOINT ["/usr/bin/lftp"]
CMD []
This means all arguments passed to docker run are forwarded directly to lftp.
lftp runs as the container processlftp (UID/GID configurable via build args)/appdocker builddocker build -t lftp:local .
docker build \
--build-arg BASEIMAGE=library/alpine:3.22.1 \
--build-arg APK_UPGRADE=false \
--build-arg LFTP_UID=1000 \
--build-arg LFTP_GID=1001 \
--build-arg IMAGE_VERSION=dev \
-t nmeyer99/lftp .
Important: do not prefix commands with lftp; pass only lftp arguments.
docker run --rm -it nmeyer99/lftp
docker run --rm -it nmeyer99/lftp \
-u username,password \
ftp://your-ftp-server.com
mirror -R (local folder -> remote)docker run --rm -it \
-v /local/path/to/directory:/data \
nmeyer99/lftp \
-e "mirror -R /data /remote/directory; bye" \
-u username,password \
ftp://your-ftp-server.com
Note: local host paths must be mounted as volumes (-v ...:/data). Use the container path (/data) inside the lftp command.
WORKDIR: /appVOLUME: /appA helper script build.sh is included to resolve the latest base image and build the container:
./build.sh
With APK_UPGRADE=true:
./build.sh "--build-arg APK_UPGRADE=true"
See LICENSE.
Content type
Image
Digest
sha256:57ca5d4fe…
Size
10 MB
Last updated
1 day ago
docker pull nmeyer99/lftp