It is assumed that Docker is already installed. You can build an environment quickly when developing a Wordpress theme.
Mac 0SX Docker 19.03.13
Create the following docker-compose.yml in the directory where you want to create the environment.
docker-compose.yml
version: "2"
services:
  wordpress:
    image: wordpress:latest
    ports:
      - "3001:80"
    depends_on:
      - mysql
    env_file: .env
    volumes:
      - ./wp-content:/var/www/html/wp-content
  mysql:
    image: mysql:5.7
    env_file: .env
    ports:
      - "3306:3306"
Go to the directory where you created docker-compose.yml and run the docker-compose command.
bash
$cd directory of created files
$ docker-compose build
$ docker-compose up
I think that the environment has started up with this, so access it with the following URL and build the site name and DB. http://localhost:3001/
Then, the following folder will be created.
python
├── docker-compose.yml
└── wp-content
    ├── index.php
    ├── languages
    ├── plugins
    ├── themes
    ├── upgrade
    └── uploads
When developing a theme, you can modify the theme in wp-content / themes.
It is quick and convenient to launch the second migration by clicking the execute button from the Docker dashboard. You can also stop it from the dashboard.
If you want to change php.ini etc., you can connect to the container by clicking the "CLI" button displayed on the right side of wordpress_wordpress_1 on the dashboard, and you can edit it using vi etc. from there.

Please point out any mistakes.
Recommended Posts