First time using docker. I used docker-compose to pull latest official wordpress image.
Created .yml file:
version: “3.9”
services:
db:
image: mysql:5.7
platform: linux/x86_64
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpresswordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- wordpress_data:/var/www/html
ports:
- “8000:80”
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
wordpress_data: {}
Run: docker-compose up
Everything worked fine when connecting to port 8000 on localhost…
Then I did the same, with the following alterations:
services:
db:
image: mysql:5.7
platform: linux/x86_64
volumes:
- db_data_1:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpresswordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- wordpress_data_1:/var/www/html
ports:
- “8080:8080”
restart: always
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data_1: {}
wordpress_data_1: {}
Note: I changed the data volume name and mapped ports 8080:8080 but everything else was left the same and I can’t connect to the wordpress login page. What am I doing wrong here?