使用 Docker Compose 快速启动 WordPress

<span class="line"><span style="color: #88C0D0">version:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #ECEFF4">"</span>
<span style="color: #A3BE8C">3.8</span>
<span style="color: #ECEFF4">"</span></span>
<span class="line"><span style="color: #88C0D0">services:</span></span>
<span class="line"><span style="color: #D8DEE9FF">    </span>
<span style="color: #88C0D0">wordpress:</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">image:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">wordpress</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">container_name:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">wordpress</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">ports:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">-</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #B48EAD">8080</span>
<span style="color: #A3BE8C">:80</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">volumes:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">-</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">./html:/var/www/html</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">environment:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">WORDPRESS_DB_HOST:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">mysql57</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">WORDPRESS_DB_NAME:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">wordpress</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">WORDPRESS_DB_USER:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">root</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">WORDPRESS_DB_PASSWORD:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">自定义密码</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">networks:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">-</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">web</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">depends_on:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">-</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">mysql57</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">restart:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">unless-stopped</span></span>
<span class="line"><span style="color: #D8DEE9FF">    </span>
<span style="color: #88C0D0">mysql57:</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">image:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">mysql:5.7</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">container_name:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">mysql57</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">ports:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">-</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #B48EAD">3306</span>
<span style="color: #A3BE8C">:3306</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">environment:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">MYSQL_ROOT_PASSWORD:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">自定义密码</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">MYSQL_DATABASE:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">wordpress</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">networks:</span></span>
<span class="line"><span style="color: #D8DEE9FF">            </span>
<span style="color: #88C0D0">-</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">web</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">restart:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">unless-stopped</span></span>
<span class="line"><span style="color: #88C0D0">networks:</span></span>
<span class="line"><span style="color: #D8DEE9FF">    </span>
<span style="color: #88C0D0">web:</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">name:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">web</span></span>
<span class="line"><span style="color: #D8DEE9FF">        </span>
<span style="color: #88C0D0">driver:</span>
<span style="color: #D8DEE9FF"> </span>
<span style="color: #A3BE8C">bridge</span></span>

输入 docker-compose up -d 起洞!