您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。