Node.js and FTP Server in a Docker Container

First of all, let me state that I am a beginner.

I was able to run different FTP servers on Docker with the help of images on Docker Hub. Thanks to the guides on the internet, I was able to run Node.js on Docker. However, what I really want to do is run them together in the same container and have the JavaScript code running on Node.js interact with the files accessible to FTP.

How can I do that? Is there any guide about it (if there is, I couldn’t manage to find it)?

Thanks in advance.

This is exactly what you should NOT do: run both in the same container.

Containers are for separation :slight_smile:

You can run both containers with a shared folder mounted from the host (doc):

docker run -d --name container1 -v /local/mydata:/data <image>
docker run -d --name container2 -v /local/mydata:/data <image>

Or use a Docker volume shared between the containers:

docker volume create mydata
docker run -d --name container1 -v mydata:/data <image>
docker run -d --name container2 -v mydata:/data <image>

For starters the shared host folder is easier, because you can easily check the files on your host. Volumes are like file containers. watch out that you don’t delete them unintended.