How to migrate an existing service docker?

I don’t know if this is the right place to ask this and I am a newbie when it comes to Docker. I have 2 existing WordPress websites that I want to “dockerify.”

Since I have a specific version of WP for the website and GIT, it is not a problem for me to store the website’s code (theme files, plugins etc). But I don’t know how to handle assets and database migrations. Should I create a docker image and then copy all the files into docker? Or should I store them in the registry also?

  • How to setup PyCharm for Docker inside Vagrant?
  • Access to Docker container
  • Unable to run java Program. Error inside docker
  • Vagrant docker provisioner and provider not using cmd: option
  • Git push hang in there
  • sonar-runner configuration in Jenkins docker
  • For database, I know that I can create an SQL file, which will be very small in size and just add the migration to Dockerfile and maybe create an automated script that will export SQL file and push it to the repository. But I don’t want to store High-res image files in GIT.

    I think my problem arises from a single concern. Can I trust docker? Are docker containers persistent? Let’s say a container got terminated. Will I lose all my work? Or can I just run it again like in vmware virtual machines?

    If it matters, I am using Gitlab for GIT, CI, and Registry.

  • Using docker-compose, how do I share my image to docker-hub?
  • Storing base java project inside child project jar (maven, docker)
  • Fail to build MongoDB replcaset with Auth on Swarm
  • Docker - access another container on the same machine via its public ip, without docker links
  • Docker on Windows Server 2016 TP4 Downloading git in container through powershell
  • How to access postgres database on host from within docker container?
  • One Solution collect form web for “How to migrate an existing service docker?”

    Seems like you should play around with Docker a bit if you want to gain confidence in it. There is no reason your WP site shouldn’t be fine using Docker if it’s set up properly. I would start with images from the official WP Docker repository as they are pretty good and will save you headache otherwise.

    Sounds like what you would want to do is use a persistent volume for your files, e.g. you would include something like this in your docker run statement: -v /var/wp/blog/wp-content:/var/www/html/wp-content which you could sync with your Git repo. This lets you abstract your code from WP itself. To update WP all you do is recreate the WP container with the new version and your files are not touched. You would want to use a separate MySql server — either in another Docker container or otherwise, basically anything the WP instance can access.

    Managing images is separate topic really, but you might want to look into a CDN for those which can be managed via various WP plugins and would not only be faster in most cases, it makes it easier to manage when they are all in one place.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.