Help! Losing Data When Migrating My WordPress Container

0
0
Asked By TechieTurtle57 On

I'm trying to move my WordPress site from an old PC to a new one. The original setup wasn't done by me, and now I'm facing some issues. Here's what I've done so far:

1. Created custom images for both WordPress and the database using Docker commands.
2. Set up a new docker-compose file based on the old containers.
3. Transferred the data from the old PC's /data/wordpress directory to the new one.
4. Ran the docker-compose command to start everything up.

However, after doing all this, it seems like all my data is gone and I have to set everything up from scratch again. Here's my docker-compose.yaml for reference:

```yaml
services:
wordpress:
image: custom/wordpress:1.0
container_name: wordpress
environment:
- WORDPRESS_DB_HOST=WORDPRESS_DB_HOST_EXAMPLE
- WORDPRESS_DB_USER=WORDPRESS_DB_USER_EXAMPLE
- WORDPRESS_DB_PASSWORD=WORDPRESS_DB_PASSWORD_EXAMPLE
- WORDPRESS_DB_NAME=WORDPRESS_DB_NAME_EXAMPLE
ports:
- "10000:80"
volumes:
- /data/wordpress/html:/var/www/html
depends_on:
- wordpressdb

wordpressdb:
image: custom/wordpressdb:1.0
container_name: wordpressdb
environment:
- MYSQL_ROOT_PASSWORD=MYSQL_ROOT_PASSWORD_EXAMPLE
- MYSQL_DATABASE=MYSQL_DATABASE_EXAMPLE
volumes:
- /data/wordpress/database:/var/lib/mysql
expose:
- "3306"
```

3 Answers

Answered By DataMover99 On

When migrating, it's super important to transfer the data from the old volumes correctly. Did you check if the permissions were set right after copying? Sometimes they don't carry over with standard commands.

Answered By CodeNinja42 On

Did you make sure to actually fill in those environment variables in your docker-compose file? Just running it without the proper values could lead to missing data.

Answered By DockerDude88 On

Moving your images to the new PC is one thing, but you should check if they included your most recent data. Relying on `docker commit` isn't recommended. Have you thought about using WordPress's built-in export feature? It might save you a lot of hassle.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.