Skip to content

Instantly share code, notes, and snippets.

@theking2
Created April 3, 2023 11:37
Show Gist options
  • Save theking2/f12f45afb40209e8262ac583032ebdea to your computer and use it in GitHub Desktop.
Save theking2/f12f45afb40209e8262ac583032ebdea to your computer and use it in GitHub Desktop.
wordpress-mariadb-phpmyadmin
version: "3"
# Defines which compose version to use
services:
# Services line define which Docker images to run. In this case, it will be MySQL server and WordPress image.
db:
image: mariadb:10.4
restart: always
environment:
MARIADB_ROOT_PASSWORD: MyR00tMySQLPa$$5w0rD
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress-user
MYSQL_PASSWORD: Pa$$5w0rD
# Previous four lines define the main variables needed for the MySQL container to work: database, database username, database user password, and the MySQL root password.
wordpress:
depends_on:
- db
image: wordpress
restart: always
# Restart line controls the restart mode, meaning if the container stops running for any reason, it will restart the process immediately.
ports:
- "8000:80"
# The previous line defines the port that the WordPress container will use. After successful installation, the full path will look like this: http://localhost:8000
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress-user
WORDPRESS_DB_PASSWORD: Pa$$5w0rD
WORDPRESS_DB_NAME: wordpress
WORDPRESS_TABLE_PREFIX: _
# Similar to MySQL image variables, the last four lines define the main variables needed for the WordPress container to work properly with the MySQL container.
volumes:
["./:/var/www/html"]
phpmyadmin-mariadb:
image: phpmyadmin/phpmyadmin:4.8.5
restart: always
depends_on:
- db
environment:
- PMA_HOST=db
- PMA_PORT=3306
- PMA_USER=wordpress-user
- PMA_PASSWORD=Pa$$5w0rD
ports:
- "8088:80"
volumes:
mysql: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment