By Brent Arias

2018-02-20 19:36:52 8 Comments

I've seen articles that teach how to migrate WordPress into Docker containers (see also here). I want to do the opposite. I am already running WordPress locally via Docker on my Windows 10 laptop. I want to migrate my local (containerized) WordPress instance into a hosted provider (e.g. WP Engine, GoDaddy, Bluehost, etc.). I don't think these hosting providers offer containerized WordPress hosting, and even if they did - it likely is more expensive than their traditional infrastructure.

I also like the idea of pushing updates (plugin and theme changes or additions) to my hosting provider via git, like I see described in this WP Engine Git Setup article.

I'd like advice or instructions for this. I am passable with my Docker skills, but I am new to WordPress. The most important things I need to understand:

  • How do I preserve articles I've written and published on my hosting provider, when I suddenly "git push" new updates to my hosting provider?
  • How do I backup my database on my local computer, given that my containerized WordPress does not have phpMyAdmin included?
  • How do I ensure that path names like "http://localhost:8000" that I use for local testing are properly replaced with the proper domain-name when I push?
  • Need I be concerned with the docker-entrypoint-initdb.d folder? Where is the official documentation for this special folder? Are there other "magic" directories like this I should be aware of?
  • How might VersionPress fit into this story, if at all?
  • Is there anything fundamentally flawed about what I am trying to achieve?

Ultimately I don't need a "git push" deployment model. For example, I doubt GoDaddy or Bluehost will offer me the "git push" capability, but their hosting is also less expensive; I could accept an FTP deploy if it was not too burdensom. But whether I deploy with git or deploy with FTP, I still want the ability to run my development effort within Docker, and version locally with git.

Also, I am not actually developing brand new WordPress themes or plugins. I am simply using my local WordPress container to add and test pre-existing themes and plugins.


I am using the docker-compose file shown below. It will only work if you change "Docker for Windows" Settings->Shared that a Windows drive (the "C" drive in my case) is shared. Here is the docker-compose file:

version: '3.2'

    image: mysql:5.7
      - type: volume
        source: wp_db
        target: /var/lib/mysql
    restart: always
      MYSQL_ROOT_PASSWORD: somewordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress

      - db
    image: wordpress:latest
      - .:/var/www/html
      - "8000:80"
    restart: always
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
        type: none
        device: ./wp-db
        o: bind

The above allows (I think) all of the WordPress themes and plugins (along with DB modifications) to be exposed on my file system, outside of the WordPress container. I can then capture these files into git. My plan is to use the WordPress .gitignore file suggested by Github, or perhaps one of the .gitignore files described in the aforementioned WP Engine article.


Related Questions

Sponsored Content

0 Answered Questions

How do i define the location of a git push to WP Engine

0 Answered Questions

Volume mounts when setting up Wordpress with docker

  • 2018-03-09 15:31:36
  • tgogos
  • 44 View
  • 1 Score
  • 0 Answer
  • Tags:   setup docker

1 Answered Questions

[SOLVED] git and local wordpress: how to handle wordpress updates?

  • 2016-10-30 12:43:39
  • mischa.mole
  • 762 View
  • 4 Score
  • 1 Answer
  • Tags:   updates git

1 Answered Questions

2 Answered Questions

[SOLVED] Hosting Wordpress on Google Apps Engine (GAE)

6 Answered Questions

[SOLVED] WordPress and Git Workflow

  • 2013-02-13 13:19:48
  • realph
  • 4597 View
  • 23 Score
  • 6 Answer
  • Tags:   deployment git

2 Answered Questions

1 Answered Questions

2 Answered Questions

[SOLVED] Git beginner: Keeping track of on-server changes

  • 2011-02-14 23:23:18
  • Kasper Sørensen
  • 527 View
  • 1 Score
  • 2 Answer
  • Tags:   git deployment

Sponsored Content