How to configure a FTP server on your Ubuntu local environment using Docker

Rafael Andrade
3 min readDec 10, 2020

Sometimes, developers around the world face the challange to integrate their application with a FTP server, downloading and uploading files from/into there.

On this tutorial, I’ll show you how to setup a FTP server Docker image on your machine and how to see its working.

First of all, you need to install docker if you don’t have it already.

After that, Open your terminal and enter the following command:

docker run -d -v /home/ftpserver:/home/vsftpd -p 20:20 -p 21:21 -p 47400-47470:47400-47470 -e FTP_USER=yourName -e FTP_PASS=yourPass -e PASV_ADDRESS=127.0.0.1 --name ftp --restart=always bogem/ftp

Let’s see what every single argument on the command does..

  • -d: Let the container runs on detached mode, making that instance of terminal free to use.
  • -v: Links a local folder with a container one. In my case, I’m using /home/rafaelribeiro/Projects/ftpserver as my local folder and /home/vsftpd as ftp server container folder. You should change the local one as you need.
  • -p: Binds some ports where the container will be available.
  • -e: Define a must have environment configurations. Here we are passing a ftp user, password and ip address. On linux, all docker containers runs on 127.0.0.1
  • — name: Sets a name to the container
  • — restart: Setting this as always, the container will restart every time that daemon does, losing its state.
  • bogem/ftp: The image used to configure our container, defined on Docker Hub.

And that’s it! Now you have a local ftp server running on a Docker container. To check it, run the following command:

docker ps -a

You’ll get something like the image below:

In order to interact with the server, you can use FileZilla, an open source software distributed free of charge under the terms of the GNU General Public License. Use the following commands on your terminal to install it:

sudo add-apt-repository ppa:sicklylife/filezillasudo apt-get updatesudo apt-get install filezilla

From there on, open the Firezilla UI and connect within the local ftp server. Important to mention that the default port is 21:

Now you can just drag and drop files into the Remote site section and see them on the local folder linked on image’s volume.

You can also use container’s bash as shown below:

Easy, isn’t it? :D

--

--

Rafael Andrade

Software developer, with more experience at back-end development, but a front-end enthusiast, working mostly with .Net and NodeJS.