Docker, Software Development

docker-compose.yml For SFTP from Atmoz

This post demonstrates how to create an SFTP Docker container from Atmoz using docker-compose.yml with the most straightforward configuration to allow for developers. Sometimes we can’t just install any FTP servers on our machines. It may be due to corporate policies, or we don’t have the permissions to do so. Also, some people don’t want their systems cluttered with seldomly used installed applications.

SFTP Docker Image

An SFTP Docker image by Atmoz is an easy-to-use SFTP (SSH File Transfer Protocol) server with OpenSSH. It runs  openssh-server within the Docker container.

docker-compose.yml File For SFTP

The following is a docker-compose.yml file that uses the SFTP Docker image by Atmoz on DockerHub. It provides us the most basic configuration for our SFTP server. Therefore, we can still customize our Docker container further depending on our needs.

To use this with Docker Compose, run the following commands in the same directory where the docker-compose.yml file is.

The following output is from the command-line window:

When you close the command-line window, it also terminates the SFTP server. If you don’t want that, use the -d option. For example:

If you encounter errors that prevent you from using the initially specified port number, change to a different port.

The following shows some details about the Docker image and container.

Testing SFTP With FileZilla Client

For testings, you can use any FTP client that works with SFTP. This post uses the FileZilla client. As shown below,  we specified the host as sftp://127.0.0.1 using the username, password, and port number specified in the docker-compose.yml and configured for the Docker Atmoz container.

Note that the root directory is read-only. You can’t create sub-directories directly under /. Also, you can’t delete the foo directory. Only the /foo, for this configuration, is writable.

This post is part of the Docker For Developers tutorial.

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like