FTP file into docker container on remote server

Viewed 21747

How can I transfer transfer files into a Docker container running on a remote Ubuntu server using an FTP client? I can SSH into the server and use docker cp, which works fine. But I have a client who needs to be able to do so with something like FileZilla. Is this possible?

2 Answers

You should not transfer files into a running container image. It's a really bad idea.

Containers come and go all the time, most container orchestrators auto-restart containers, so the files you upload will be wiped as the container restarts cleanly form its original image.

Best-practice: Rebuild and redeploy the container image every time you need to make a change to a production application running inside a container.

If you need for testing purposes: Docker containers don't expose a FTP server, because containers are supposed to run only 1 process (i.e. your ENTRYPOINT application). However, you can use commands like docker cp to copy files from/to running containers.

Related