Big Data era has entered many disciplines and Earth Observation is no exception. As a result, the need to interact more and more with remote machines who act as servers constantly increases since our local machines are incapable of managing such huge volumes of remote sensing data. Therefore you’ll need to be more productive in your interaction with the remote machine. One example of interaction is the exchange of files between the server and your local machine. There are a couple of ways to do this but SFTP via a docker container is what I prefer the most. Why docker container? Because of these.
Tools you will need
- GNU/Linux (my example is on Ubuntu)
- Docker
- Remmina (or any other remote desktop client)
Connect with your server in whichever way you prefer, e.g. SSH, RDP. If it’s RDP please open the terminal and pull the atmoz/sftp docker image.
$ sudo docker pull atmoz/sftp
Before creating and running a docker container of the sftp image you’ll need to check out which ports of the system are in use so you can indirectly infer which ports are not in use. There are several ways to do this; one of them is the one below which will show the TCP/UDP (v4, v6) ports that are listening or have an established connection:
$ netstat -latu
Now you should look for the used ports in the Local Address column where the convention is IP:port. As a result, you can decide which port to use when running a docker container.
Extra info: Why care about ports?
Simply put, a port is a communication channel and can be associated with e.g. a service such as SSH or HTTP. The services are asked questions (or requests) by a client (e.g. you local machine) and give answers (or responses). In our example, SFTP runs as a service inside a docker container using a specified port (22). Docker container’s port need to be associated with a port of the server. The latter is the one that we basically need to know whether it’s in use or not. Just aim for port numbers 49152–65535 (ephemeral ports)
Next you need to create a directory on the server (e.g. /path/to/dir) which will be shared between the docker container and server, and will be the one that you will use for file sharing. In addition, you may need to insert the server’s public IP. After that, simply modify and run the command below which assumes default username/password for the docker container’s OS.
$ sudo docker run -v /path/to/dir:/home/foo/upload --ip <server-ip> -p <server-port-number>:22 -d atmoz/sftp foo:pass:1001
Finally, you can connect to the shared folder using Remmina or any other remote desktop client using the credentials and server info as below (assuming you run the default docker image without creating any new password or user).

For more info on how to customize your dockerized SFTP server, e.g. make it more secure please follow additional info provided here.
Thanks for reading and keep reading!
Tags: docker linux remmina sftp ssh ubuntu