Install and run an FTP server using Docker

To install and run an FTP server using Docker, follow these steps. We’ll use the popular stilliard/pure-ftpd image, which is a lightweight and widely used FTP server.

Step 1: Install Docker

Make sure Docker is installed on your machine. If it isn’t, install it using the instructions below:

  • Ubuntu/Debian:

    sudo apt update
    sudo apt install docker.io -y
    
  • Mac: Install Docker Desktop from Docker's website.

  • Windows: Install Docker Desktop from Docker's website.

Verify Docker is installed:

docker --version

Step 2: Pull the FTP Server Docker Image

Use the stilliard/pure-ftpd image, which is a simple and effective FTP server.

docker pull stilliard/pure-ftpd

Step 3: Run the FTP Server

Run the FTP server container using the following command:

docker run -d --name ftp-server \
  -p 21:21 -p 30000-30009:30000-30009 \
  -e FTP_USER_NAME=testuser \
  -e FTP_USER_PASS=testpass \
  -e FTP_USER_HOME=/home/testuser \
  stilliard/pure-ftpd

Explanation:

  • -d: Runs the container in detached mode (in the background).
  • --name ftp-server: Names the container ftp-server.
  • -p 21:21: Maps port 21 on the host to port 21 in the container (FTP control port).
  • -p 30000-30009:30000-30009: Opens a range of ports for passive mode FTP.
  • -e FTP_USER_NAME=testuser: Creates an FTP user named testuser.
  • -e FTP_USER_PASS=testpass: Sets the password for the user as testpass.
  • -e FTP_USER_HOME=/home/testuser: Sets the home directory for the FTP user.
  • stilliard/pure-ftpd: The Docker image to use.

Step 4: Verify the FTP Server

To check if the FTP server is running, use:

docker ps

You should see the ftp-server container listed. If it’s running correctly, you can try connecting to it using an FTP client like FileZilla or ftp from the command line.

Step 5: Test the FTP Connection

You can connect to the FTP server using a command-line FTP client:

ftp localhost 21
  • Username: testuser
  • Password: testpass

You should be able to log in and access the home directory /home/testuser.

Optional: Stop and Remove the FTP Server Container

To stop the container:

docker stop ftp-server

To remove the container:

docker rm ftp-server

That’s it! You now have an FTP server running using Docker.

댓글

이 블로그의 인기 게시물

Using the MinIO API via curl

훈민정음 1

Joining an additional control plane node to an existing Kubernetes cluster

CDPEvents in puppeteer

Vespa vs Milvus

kafka polling vs listen

How to change java version on gradle of flutter

The pierce selector in Puppeteer