FTP into existing Docker Containers

daniel picture daniel · Oct 24, 2014 · Viewed 13.8k times · Source

I'm looking to see if it is possible to somehow FTP into an already existing Docker container? For example, I'm using the dockerfile/ghost in combination with jwilder/nginx-proxy, and once I deploy/build a container, I'd like for the user to be able to FTP into the container running Ghost so they can upload additional files such as themes, stylesheets, etc. What would be the best method in accomplishing this? Thanks in advance!

Answer

Arthur Ulfeldt picture Arthur Ulfeldt · Oct 24, 2014

You have a few choices:

  • run ftp in the Ghost container and expose a port
  • use a host directory to store the user content and give them FTP to the host (not the best choice)
  • map the same host directory into both the Ghost container and the FTP server container

Personally I thnk the last one is the best and the most work though the advantages will be worth it in the long run. I'm making the assumption that the uploaded content should survive container termination which is why I recommend using a mapped host directory, if this is not the case you can use linked volumes between the FTP container and the Ghost container.