Best approach: classical existing wp -> new server with docker

Whats the best approach to port a classic existing wp installation (debian, apache, mysql …) into working docker containers on a new server?

Are there any scripts to do so?

I’d use the official Wordpress image: https://hub.docker.com/r/_/wordpress/. Pay close attention to that Compose file, using Compose will make your life easier (you’ll probably substitute mysql for mariadb)

It should be fairly straightforward to bake the code of your website into the container using COPY.

Once you have a working Docker image, you will need to port the data using something like mysqldump. Dump the data from your existing install and use it to populate the new DB instance. You can run this on a container which has a persistent volume to ensure that it stays the same across container runs (just share the volume between containers).

Then, you’re done.