Docker for Local WordPress Development

Visits: 211

Create a file  called docker-compose.yml with the following code in your project directory and then enter ‘docker-compose up’ at the command line.

version: "2"
services:
  my-wpdb:
    image: mariadb
    ports:
      - "8081:3306"
    environment:
      MYSQL_ROOT_PASSWORD: verysecret
  mywp:
    image: wordpress
    volumes:
      - ./:/var/www/html
    ports:
      - "8080:80"
    links:
      - my-wpdb:mysql
    environment:
      WORDPRESS_DB_PASSWORD: verysecret