您好,登錄后才能下訂單哦!
yum install docker
systemctl start docker
systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose -v
docker-compose version 1.23.2, build 1110ad01
存放web-sql和Wordpress數據 (文件夾名稱推薦按照站點域名一致)
mkdir -p /wordpress/
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
如果使用nginx做代理訪問wordpress,修改docker 端口映射信息,將80端口讓出即可:
ports:
- "8080:80"
cd /wordpress/
docker-compose up -d
docker-compose ps
or
docker ps
## 初始化站點
由于wordpress初始化過程會根據訪問站點地址初始化數庫信息,推薦首次初始化站點使用正式域名訪問,沒有進行dns解析的,可以先寫host文件。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。