Installation of Docker and VSFTPD on Ubuntu 22.04

Chinmay Roy
2 min readJul 15, 2024

--

Today I am going to talk about the steps to install Docker on Ubuntu 22.04 and set up a container running vsftpd (Very Secure FTP Daemon):

Step 1: Install Docker on Ubuntu 22.04

  1. Update your system:
sudo apt update 
sudo apt upgrade -y
  1. Install Docker:
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install -y docker-ce
  1. Verify Docker Installation:
sudo systemctl status docker
  1. Add your user to the docker group (optional):
sudo usermod -aG docker ${USER}
  1. Logout and log back in to apply the changes.

Step 2: Create a Docker Container with vsftpd

  1. Create a Dockerfile for vsftpd:
  2. Create a directory for your project:
mkdir vsftpd-docker 
cd vsftpd-docker
  1. Create a file named Dockerfile:
nano Dockerfile
  1. Add the following content to the Dockerfile:
FROM fauria/vsftpd  
# Set the FTP user and password
ENV FTP_USER= username
ENV FTP_PASS= 123456
# Expose FTP ports
EXPOSE 20 21 21100-21110
  1. Build the Docker image:
docker build -t my-vsftpd .
  1. Run the Docker container:
docker run -d -p 21:21 -p 20:20 -p 21100-21110:21100-21110 -v /host/path/to/ftp/files:/home/vsftpd --name my-vsftpd-container my-vsftpd
  1. Replace /host/path/to/ftp/files with the path on your host system where you want to store the FTP files.
  2. Verify the container is running:
docker ps

Step 3: Connect to vsftpd

You can now connect to the vsftpd server using an FTP client (e.g., FileZilla) with the following details:

  • Host: Your server’s IP address
  • Port: 21
  • Username: username (as specified in the Dockerfile)
  • Password: 12345 (as specified in the Dockerfile)

If you need any more help then please comment down below.

--

--

Chinmay Roy
Chinmay Roy

No responses yet