【Vegas原创】Docker安装最新版wordpress

2年前 (2022) 程序员胖胖胖虎阿
233 0 0

0.安装docker

curl -fsSL https://get.docker.com | bash -s docker --mirror aliyun
service docker start

1. docker pull最新版的wordpress

docker pull wordpress

image

2.docker 安装mysql

[root@3 ~]# docker pull mysql

image

3. 配置mysql

docker run -d --privileged=true --name mysql -v /data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=vegasd -p 3306:3306 mysql

image

4.启动wordpress

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

image

-p: 这里是指定 WordPress 容器的访问端口
--link: 意思是将 mysql容器挂载到 mysql,这样 WordPress 就能通过 mysql 访问到docker中的数据库了

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 开始愉快的玩耍。

image

版权声明:程序员胖胖胖虎阿 发表于 2022年10月7日 下午4:08。
转载请注明:【Vegas原创】Docker安装最新版wordpress | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...