Skip to content

Instantly share code, notes, and snippets.

@daaniam
Created January 13, 2024 06:10
Show Gist options
  • Save daaniam/e3424882634f31a17f798be49cd543cf to your computer and use it in GitHub Desktop.
Save daaniam/e3424882634f31a17f798be49cd543cf to your computer and use it in GitHub Desktop.
Dockerized FTP client

Dockerfile

FROM debian:bookworm-slim
RUN apt update && apt install -y lftp

Send from terminal

docker run -v $(pwd)/file_to_send:/tmp/file_to_send \
-p 2020:20/tcp -p 2121:21/tcp  --network host \
ftpdocker lftp ftp://user:123@localhost:21 \
-e "put /tmp/file_to_send; bye"
  1. Mount file "file_to_send" to container /tmp/file_to_send
  2. Run client on localhost network (2020 and 2021)
  3. Execute lftp command with rmeote server URL, username & password
  4. Send FTP command (file) and close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment