docker学习

Centos docker配置yum源

进入清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/

阿里云的镜像服务器:https://dev.allyum

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo

修改docker-ce.repo的下载位置

vi docker-ce.repo 
将https://download.docker.com/修改成https://mirrors.tuna.tsinghua.edu.cn/docker-ce/
执行:
:%s@https://download.docker.com/@https://mirrors.tuna.tsinghua.edu.cn/docker-ce/@
docker run --name b1 -it busybox:latest  ---启动busybox镜像的latest版本,name镜像名字,it是交互,
docker inspect b1			 ---查看b1镜像的详细信息
docker ps -a				---查看docker的所有镜像
docker ps				---查看当前运行的docker镜像
docker start -ai b1			---启动b1镜像,ai是交互
docker kill b1				---杀掉b1镜像
docker rm b1				---删除b1镜像
docker run --name web1 -d nginx:1.14-alipine ---启动nginx的1.14-alipine的版本,-d后台运行
docker logs web1			---查看镜像web1的日志
docker exec -it web1 /bin/sh		---exec绕过容器进入镜像web1,查看镜像的内部运行情况,/bin/sh在镜像中运行shell
docker pull quay.io/spaces-dev/redis	---在https://quay.io下载镜像
docker commit -p b1			---将b1制作成镜像,p是暂停正在运行的镜像
docker tag 9048dc7af75b mage/httpd:v0.1-1 ---给IMAGE ID为9048dc7af75b的镜像打上标签mage/httpd v0.1-1
docker tag mage/httpd:v0.1-1 mage/httpd:latest	---给一个镜像多个标签
docker image rm mage/httpd:latest		---删除镜像,
docker commit -a "ch<ch.qq.com>" -c 'CMD ["/bin/httpd","-f","-h","/data/htl"]' -p b1 mage/httpd:v0.2
---创建新镜像,a作者邮箱,c这是镜像的启动程序,p暂停后创建,b1镜像名称,mage/httpd:v0.2新镜像标签
docker login -u ch -p server	---登录仓库服务器,u账号,server仓库服务器地址
docker push mage/httpd		---给仓库推送mage/httpd镜像
docker save -o myimages.gz mage/httpd:v0.1 mage/httpd:v0.1
---将镜像mage/httpd:v0.1和mage/httpd:v0.1打包为myimages.gz
docker load -i myimages.gz    ---解压myimages.gz包

 

安装桥接yum -y install birdge-utils

brctl show    ---查看桥接情况
ip link show    ---查看网卡情况

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值