[docker]运行centos
2020/08
27
11:08
一、安装包下载
https://www.docker.com/products/docker-desktop
二、在BIOS中启动VT技术
三、装完之后,重启Windows,然后打开cmd或者Powershell,即可输入docker命令
四、拉取centos包
docker pull centos:7
pull为拉取,centos为包名,:7 为版本号
rmi为删除镜像,docker rmi IMAGEID
五、查看包
docker images
六、运行容器
docker run -itd (-p 主机端口:容器端口 IMAGEID) /bin/bash
也可以挂载本机磁盘到 目标容器中, -v Host:Docker,例如
docker run -itd -p 80:80 -v d:\:/soft myimage /bin/bash, 把则本机D盘映射到目标的/soft中
七、进入容器
docker attach CONTAINERID
或
docker ps
docker exec -it CONTAINERID /bin/bash
八、保存容器的修改
docker ps -l
docker commit CONTAINERID myname
- centos安装nginx
下载 http://mirrors.aliyun.com/repo/Centos-7.repo
覆盖/etc/yum.repos.d/CentOS-Base.repo
然后运行:
yum clean all
yum makecache
yum install epel-release
yum install nginx
- 必要包安装
- ifconfig:yum install net-tools
- lsof:yum install lsof
- wget: yum install wget
九、在Centos中启动 Docker
service docker start
CopyRights: The Post by BY-NC-SA For Authorization,Original If Not Noted,Reprint Please Indicate From 老刘@开发笔记
Post Link: [docker]运行centos
Post Link: [docker]运行centos