I have a web server with multiple PHP website. I push all my updates through FTP.
I intend to move to a more containerized environnement without changing to much of my current basic workflow.
I would like to deploy each of my website in a Docker container. The database for all the website would be in another container. I will have a Docker as a reverse proxy.
To update my website, i have two ideas :
What do you think of it ?
Thanks for your help
Changing the code inside a running container, or at all, is against docker best practices, as containers are designed to be ephemeral.
A better idea would be to rebuild the image every time you update the code, allowing the containers to stay ephemeral, and making it easier to scale. You could implement this through CI/CD, but that is out of the scope of this question.
If you really want to continue with the idea of ftp still, it's a good idea to have one container with an ftp service in it, and another one with the web server in, as containers should have only one concern.
If your FTP server image is
my/ftp-image and your web server is
my/web-server-image, then you can start your containers like this:
docker run -itd --name my-web-server -p 80:80 -v files_volume_name_here:/path/to/files/in/container my/web-server-image docker run -itd --name my-ftp-server [ports for ftp server here] -v files_volume_name_here:/path/to/files/in/container my/ftp-image