# How to migrate from traditional setup to Docker based Ghost?

**URL:** <https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816>\
**Category:** Self-hosting\
**Created:** [May 28, 2025, 11:21am UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816 "2025-05-28T11:21:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![hackermade](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hackermade/32/33939_2.png) [@hackermade](https://forum.ghost.org/u/hackermade)\
**Post date:** [May 28, 2025, 11:21am UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/1 "2025-05-28T11:21:59Z")

</div>

Greetings, i was wondering if there is any tutorial or blog post that describes the process of moving the data (`content` folder, `config.production.json` file and `db.sql` file) from direct ubuntu installtion to a Docker setup consist of 2 containers (ghost and db).

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [May 28, 2025, 12:20pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/2 "2025-05-28T12:20:43Z")

</div>

The content folder is easy. Just copy it:

> **[docker container cp](https://docs.docker.com/reference/cli/docker/container/cp/)**

The `config.production.json` usually goes into environment variables.

> **[Configuration - Adapt your publication to suit your needs](https://ghost.org/docs/config/#running-ghost-with-config-env-variables)**
>
> Find out how to configure your Ghost publication or override Ghost's default behaviour with robust config options, including mail, storage, scheduling and more!

> **[Set environment variables](https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/)**
>
> How to set, use, and manage environment variables with Compose

You can, of course, also set a bind mount for the `config.production.json`:

> **[Bind mounts](https://docs.docker.com/engine/storage/bind-mounts/)**
>
> Using bind mounts

The big problem will be the SQLite file. There is no direct way to convert that to MySQL. The “dialect” is quite different.

There are a few commercial products that can do it. I haven’t seen a “one click” or “one command” option that works for that.

The “easiest” would be to just migrate using the JSON exports. You will lose some data with this though (newsletter analytics, comments).

---

<div class="post-metadata">

**Author:** ![hackermade](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hackermade/32/33939_2.png) [@hackermade](https://forum.ghost.org/u/hackermade)\
**Post date:** [May 28, 2025, 12:39pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/3 "2025-05-28T12:39:24Z")

</div>

No, the db.sql is a file that i exported from MySQL with mysqldump not SQLite.

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [May 28, 2025, 12:40pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/4 "2025-05-28T12:40:41Z")

</div>

In that case, just use `mysql`:

> **[How To Import and Export Databases in MySQL or MariaDB | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb#step-2-mdash-importing-a-mysql-or-mariadb-database)**
>
> Being able to import and export your database is an important skill to have. You can use data dumps for backup and restoration purposes, so you can recover o…

---

<div class="post-metadata">

**Author:** ![hackermade](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hackermade/32/33939_2.png) [@hackermade](https://forum.ghost.org/u/hackermade)\
**Post date:** [May 28, 2025, 12:42pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/5 "2025-05-28T12:42:38Z")

</div>

When i try to remove the content folder from the container because i want to replace it with the backed up content folder i get this:

```auto
rm: can't remove 'content': Resource busy

```

Maybe because is being used

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [May 28, 2025, 12:45pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/6 "2025-05-28T12:45:41Z")

</div>

I feel like you might be missing some docker basics. Happy to help, but as with any self-hosting, I am of the opinion that you should understand the technology first, before putting a server into the WWW.

Containers are generally stateless. So, emptying the `content` folder should happen through the volume.

If you have a named volume, stop the Docker container, and remove the volume:

> **[docker volume rm](https://docs.docker.com/reference/cli/docker/volume/rm/)**

The next time you start the container with your Docker Compose (I assume) file, it will be created again.

If you have a bind mount, delete the content _inside_ the `content` folder, not the `content` folder itself.

---

<div class="post-metadata">

**Author:** ![hackermade](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hackermade/32/33939_2.png) [@hackermade](https://forum.ghost.org/u/hackermade)\
**Post date:** [May 28, 2025, 12:56pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/7 "2025-05-28T12:56:08Z")

</div>

Ohhh ok now i understood why the container broke after i added the files inside the container, ok jannis thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![hackermade](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hackermade/32/33939_2.png) [@hackermade](https://forum.ghost.org/u/hackermade)\
**Post date:** [May 31, 2025, 6:38pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/8 "2025-05-31T18:38:50Z")

</div>

Which is the best way to stored data for Ghost in Docker? Volumes or Bind Mounts?

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [May 31, 2025, 6:50pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/9 "2025-05-31T18:50:24Z")

</div>

Matter of preference. Both have their advantages.

I personally prefer volumes since they are the more modern way, contained, and can be interacted with using the docker cli. Others prefer bind mounts, since there is a physical copy on the host, you can easily interact with.

---

<div class="post-metadata">

**Author:** ![hackermade](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hackermade/32/33939_2.png) [@hackermade](https://forum.ghost.org/u/hackermade)\
**Post date:** [May 31, 2025, 7:04pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/10 "2025-05-31T19:04:14Z")

</div>

Better for speed, backup and ease of use?

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [May 31, 2025, 7:28pm UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/11 "2025-05-31T19:28:36Z")

</div>

For all of these: it depends.

Seriously, as with most things in this sphere, there is no one-size-fits-all answer. Are you familiar with the Docker CLI? Just use volumes. Are you more comfortable with native host file operations? Use a bind mount.

You can always try both and see for yourself. And change down the line.

---

<div class="post-metadata">

**Author:** ![justinacolmena](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/justinacolmena/32/33609_2.png) [@justinacolmena](https://forum.ghost.org/u/justinacolmena)\
**Post date:** [June 3, 2025, 1:55am UTC](https://forum.ghost.org/t/how-to-migrate-from-traditional-setup-to-docker-based-ghost/57816/12 "2025-06-03T01:55:16Z")

</div>

Great question. The setup needs to be robust. Knock it around crash the database, rebuild from backup etc. I like nodejs websites in general because they’re so quick and easy to build and set up totally from scratch, fast and reliable and although I’m more familiar programming in php myself, that language is suffering from major long term performance and security issues.

Nodejs is all roll-your-own and build-it-yourself unless you do use Docker / Kubernetes etc., and even then, we’re entering a dangerous era of wholesale engineered fragility and things designed intentionally to fail, while communists and anarchists engage in polite debates about critical infrastructure.
