用docker创建个人博客

本文介绍了如何通过Docker拉取MySQL5.7版本镜像,创建并配置容器,以及后续创建WordPress数据库和容器,并进行端口映射,最终在浏览器中访问和安装WordPress。
摘要由CSDN通过智能技术生成

1,查看MySQL镜像版本

[root@localhost ~]# docker search mysql

 2,拉取MySQL5.7版本

[root@localhost ~]# docker pull mysql:5.7
5.7: Pulling from library/mysql
20e4dcae4c69: Pull complete 
1c56c3d4ce74: Pull complete 
e9f03a1c24ce: Pull complete 
68c3898c2015: Pull complete 
6b95a940e7b6: Pull complete 
90986bb8de6e: Pull complete 
ae71319cb779: Pull complete 
ffc89e9dfd88: Pull complete 
43d05e938198: Pull complete 
064b2d298fba: Pull complete 
df9a4d85569b: Pull complete 
Digest: sha256:4bc6bc963e6d8443453676cae56536f4b8156d78bae03c0145cbe47c2aad73bb
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7

3,创建MySQL容器 ,并端口映射

[root@localhost ~]# docker run -d --name=mysql01 -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 mysql:5.7
f0a23bdd72dee60f980d48a2dd42fd44b754d4ffb872734f1fb26308928999c3

 4,进入MySQL中创建数据库(wordpress)

[root@localhost ~]# docker exec -it mysql01 /bin/bash
bash-4.2# mysql -u root -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.44 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, 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 wordpress;
Query OK, 1 row affected (0.00 sec)

5,拉取个人博客镜像(wordpress) 

[root@localhost ~]# docker pull wordpress

6, 创建wordpress容器并做端口映射

[root@localhost ~]# docker run -d --name=wordpress01 -p 80:80 wordpress
9b535d03d848a1c4c617764bb53d3797d77ccf67368d1de9db47caa113dd5843

7,在浏览器中打开wordpress 

 

8, 安装wordpress

 

 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值