Installation of Docker and VSFTPD on Ubuntu 22.04
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
- Update your system:
sudo apt update
sudo apt upgrade -y
- 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
- Verify Docker Installation:
sudo systemctl status docker
- Add your user to the docker group (optional):
sudo usermod -aG docker ${USER}
- Logout and log back in to apply the changes.
Step 2: Create a Docker Container with vsftpd
- Create a Dockerfile for vsftpd:
- Create a directory for your project:
mkdir vsftpd-docker
cd vsftpd-docker
- Create a file named
Dockerfile
:
nano Dockerfile
- 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
- Build the Docker image:
docker build -t my-vsftpd .
- 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
- Replace
/host/path/to/ftp/files
with the path on your host system where you want to store the FTP files. - 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.