Skip to content

Instantly share code, notes, and snippets.

@nakov
Last active May 6, 2020 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakov/0516018a41cb3faa54fef2aea97e45e2 to your computer and use it in GitHub Desktop.
Save nakov/0516018a41cb3faa54fef2aea97e45e2 to your computer and use it in GitHub Desktop.
WordPress + MySQL on Docker Compose

Install Docker / or use Play with Docker (https://labs.play-with-docker.com) with Docker Hub free registration.

Create the docker-compose.yml file, e.g. using cat > docker-compose.yml

Run the containers (WordPress and MySQL):

docker-compose up -d

Check the containers state:

docker ps

Open WordPress in the Web browser: https://localhost:8000

version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment