0.安装docker curl -fsSL https://get. | bash -s docker --mirror aliyun service docker start 1. docker pull最新版的wordpress docker pull wordpress
2. docker 安装mysql [root@3 ~]# docker pull mysql
3. 配置mysql (可以写成sh) docker run -d --privileged=true --name mysql -v /data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=vegasd -p 3306:3306 mysql
4.启动wordpress(可以写成sh) docker run -d --name wordpress -e WORDPRESS_DB_HOST=mysql -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=vegasd -e WORDPRESS_DB_NAME=wp -p 81:80 --link mysql:mysql wordpress
-p: 这里是指定 WordPress 容器的访问端口 wp:数据库名 5.进入mysql的bash,创建wp数据库 [root@3 ~]# docker exec -it mysql bash root@b310463fd2a5:/# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 34 Server version: 8.0.25 MySQL Community Server - GPL Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database wp; Query OK, 1 row affected (0.01 sec) mysql> exit Bye root@b310463fd2a5:/# 6,访问 http://ip:81 开始愉快的玩耍。
|
|