Reputation: 2542
I have a Wordpress installation running in a Docker instance. I'm having a problem with e-mail and it's likely due to sendmail
missing. If indeed I have to add sendmail
to the container, what is the intended way to do this? I've seen the lxc hacks but it's always stated or at least implied that this isn't within the intentions of how Docker is supposed to work. I decided on Docker for my Wordpress site because I already had a running system with HTTP services installed and the idea of basically sectioning off everything (Apache, PHP, MySQL, etc.) really appealed to me. I can then just backup the whole container and move it to another system in entirety if need be.
To state my question as directly as possible, what method of modifying a running container is most appropriate for the intended design of Docker? Should I just attempt the ad-hoc bash prompt via lxc-attach as mentioned above? Or is there a more appropriate way like making the container a new image (to preserve all my WP data) and modifying the image and then re-starting the container?
Upvotes: 0
Views: 260
Reputation: 15092
Long answer:
I'd recommend changing the way your project is structured.
Having a database inside your container is okay for local development - when you don't care if the changes you make are lost every time you restart your container.
At the moment, if your container dies for any reason, or if you need to restart it for any reason, your data will be lost.
Using nsenter
(mentioned below) to attach to your running container when you need to:
mysql
on your host machinemysqldump
of your databasescp
your .sql file from your container to your hostThe way I look at whether or not my Docker projects are set up correctly is this:
If you can't get back to where your container currently is at the moment in an automated fashion, you're doing something wrong.
Short answer:
Use nsenter to attach to your container and make the changes you need.
And pray that nothing goes wrong with your container so you don't lose your data.
Upvotes: 2