Get the App
SLTechnology News&Howtos  ›  Servers  › 

Docker-compose Quick start wordpress Service

Shulou Source: shulou.com Published: 2022-06-03 06:15:57 09月21日 Update

Deploy: install dockeryum install dockersystemctl start dockersystemctl enable docker install docker-composesudo curl-L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname-s)-$(uname-m)"-o / usr/local/bin/docker-composesudo chmod + x / usr/local/bin/docker-composesudo ln-s / usr/local/bin/docker-compose / usr/bin/docker-compose version docker-compose-vdocker-compose version 1.23.2, build 1110ad01 create a new directory Store web-sql and Wordpress data (the folder name is recommended to be consistent with the site domain name)

Mkdir-p / wordpress/

Generate docker-compose file

Vi docker-compose.yml

Version: '3.3'services: db: image: mysql:5.7 volumes:-/ wordpress/db_data:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: wordpress-root MYSQL_DATABASE: wordpress-db MYSQL_USER: wordpress-user MYSQL_PASSWORD: wordpress-user-ps wordpress: depends_on:-db image: wordpress:latest Volumes:-/ wordpress/wordpress_data:/var/www/html ports:-"80:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress-user WORDPRESS_DB_PASSWORD: wordpress-user-ps WORDPRESS_DB_NAME: wordpress-db using the nginx agent

If you use nginx as a proxy to access wordpress, modify the docker port mapping information and give up port 80:

Ports:-"8080 wordpress/docker-compose up 80" startup service: cd / wordpress/docker-compose up-d check container status docker-compose psor docker ps## initialization site. Since the wordpress initialization process initializes the database information based on the address of the visiting site, it is recommended to use the official domain name for the first initialization site. If there is no dns resolution, you can write the host file first.

Tags: Site file information domain name port agent recommendation service consistency name address container data folder version status directory process build Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple NVidia macOS Xiaomi MySQL