记录一次博客迁移到Docker上的操作
时间:2022-11-27 00:19:17
这篇文章主要介绍了一次博客迁移到Docker上的操作记录,Docker是当下最火爆的虚拟机类技术,需要的朋友可以参考下
我的个人博客一直是跑在阿里云主机上的,最近接触了docker 心血来潮想把自己的应用打包到docker容器中去,方便以后的迁移部署
docker版本:
复制代码代码如下:
[root@AY140716133600881bf5Z ~]# docker version
Client version: 1.6.0-rc5
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): fc4825d
OS/Arch (client): linux/amd64
Server version: 1.6.0-rc5
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): fc4825d
OS/Arch (server): linux/amd64
下面是我迁移的操作记录:
复制代码代码如下:
# 参数解释:
--name: 指定容器名字
-v: 把宿主主机目录挂在到容器目录上
--restart always: 不管退出码是多少都要重启
--link: 容器和容器之间建立连接
# 启动php容器
docker run -d --name php-5.6.9 -v /alidate/www:/data/www --restart always ted1993/php:5.6.9
# 启动mysql容器
docker run -d --name mysql-5.5.37 -v /alidata/server/mysql/data:/data/server/mysql/data/ --restart always ted1993/mysql:5.5.37
# 启动nginx容器
docker run -d -p 80:80 --name nginx-1.4.7 -v /alidate/www:/data/www --restart always --link mysql-5.5.37:mysql_link php-5.6.9:php_link ted1993/nginx:1.4.7
容器都跑起来了,我把网站目录和数据库数据目录 都挂在到容器中去,这样方便我去管理 比如说在本地修改个什么文件都可以直接和容器之间进行同步,下面只要简单把连接数据库的地址更改为mysql_link就可以了。
为了方便我管理我使用csphere通过web去管理docker。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
微信转错账怎么办 微信转错账的解决办法
WPS重命名无法完成,是因为文档已经打开了
![](https://img.aspxhome.com/file/2023/2/a185742_0s.jpg)
Excel中进行表格IF函数的具体操作
Creo5.0如何制作钣金的圆角?Creo5.0制作钣金圆角的操作步骤
![](https://img.aspxhome.com/file/2023/8/a332833_0s.jpg)
win10文件资源管理器/控制面板地址栏可运行命令
![](https://img.aspxhome.com/file/2023/30/a263451_0s.png)
excel中怎么添加底纹
![](https://img.aspxhome.com/file/2023/5/36015_0s.jpg)
Win7系统总是提示windows资源管理器已停止工作怎么修复
![](https://img.aspxhome.com/file/2023/3/a292151_0s.jpg)
360浏览器打不开网页怎么回事?
![](https://img.aspxhome.com/file/2023/7/a328998_0s.png)
Win7电脑清理垃圾的运行命令代码是什么?
![](https://img.aspxhome.com/file/2023/26/a228810_0s.png)
微信正式支持 iOS 深色模式,没有收到更新怎么办?
![](https://img.aspxhome.com/file/2023/4/a195554_0s.png)
打开Word时提示:Word遇到问题需要关闭。我们对此引起的不便表示
![](https://img.aspxhome.com/file/2023/7/24507_0s.jpg)
Win7系统玩游戏提示显存不够的解决方法
![](https://img.aspxhome.com/file/2023/2/a288397_0s.jpg)
excel中快速清除单元格中内容的快捷方法
QQ同步助手怎么用?QQ同步助手怎么备份?
![](https://img.aspxhome.com/file/2023/8/a339916_0s.jpg)
腾讯视频怎么联系人工在线客服-腾讯视频联系人工在线客服方法
![](https://img.aspxhome.com/file/2023/3/a294153_0s.jpg)
excel中画斜线的教程
Win7旗舰版硬盘怎么低级格式化?
![](https://img.aspxhome.com/file/2023/27/a229606_0s.png)
教您把word文档直接转换成ppt文档的方法
![](https://img.aspxhome.com/file/2023/1/29481_0s.jpg)
Wps如何清除单元格内容?Wps清除单元格内容的方法
![](https://img.aspxhome.com/file/2023/5/a182335_0s.gif)
Win7系统怎么关闭dwm.exe进程
![](https://img.aspxhome.com/file/2023/1/a279957_0s.jpg)