部署docker容器
作为个人开发平台,最好的运行环境就是Docker,可以把各种开发测试环境通过dokcer完美地运行于一个笔记本内,并且不会影响到host主机操作系统环境。非常方便迭代和复杂测试。
安装docker
通过发行版安装docker
sudo dnf install docker启动docker
sudo systemctl start docker设置docker在操作系统启动时启动
sudo systemctl enable docker部署CentOS容器
下载CentOS 5/6/7 版本基础镜像
sudo docker pull centos:5
sudo docker pull centos:6
sudo docker pull centos:7在host主机上创建
share-data卷
各容器中通过host上的存储卷共享数据,这样方便数据交换和备份
docker volume create share-data启动共享存储的容器
在虚拟容器内部安装需要的软件包:
启动sshd
使用非systemd的CentOS 5/6 可以使用/etc/init.d/sshd start来启动ssh服务。
上述手工操作可以通过DockerFile来自动完成,参考 使用Docker快速部署不同版本CentOS容器 最后部分使用的DockerFile操作方法。
参考
Last updated
Was this helpful?