I’m new with Docker, I’m trying to migrate some WP app from a standard LAMP stack to Docker. This is my docker-compose.yml
.
version: ‘2’
services:
db:
container_name: database
image: mariadb
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
volumes:
- ./database/data:/var/lib/mysql
- ./database/initdb.d:/docker-entrypoint-initdb.d
restart: always
my_wordpress:
image: wordpress
container_name: my_wordpress
depends_on:
- db
ports:
- "80:80"
volumes:
- ./wp:/var/www/html/
links:
- db:mariadb
restart: always
environment:
DB_HOST: db:3306
DB_NAME: wordpress
DB_USER: wordpress
DB_PASSWORD: wordpress
wp-cli:
image: tatemz/wp-cli
container_name: wp-cli
volumes_from:
- my_wordpress
links:
- db:mariadb
entrypoint: wp
command: "--info"
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
depends_on:
- db
restart: always
ports:
- "8080:80"
environment:
PMA_ARBITRARY: 1
PMA_HOST: db
MYSQL_ROOT_PASSWORT: wordpress
redis:
image: redis:latest
container_name: redis
This docker file is in the following folder structure:
- wp/ --> where my existing WP installation is stored
- database/
-- data/ --> existing database in .sql format
-- initdb.d/ --> esisting database in .sql format
- docker-compose.yml
The containers are running fine but I always get redirect to the startup WP screen for installing it from scratch. The existing files don’t get recognised and neither the database.
I’m sure I’m missing something but I can’t really see it.
Thanks in advance.