部署Docker以及基础命令

一、安装一个Docker

1、配置一个Docker的yum源

#这里我们使用阿里云的yum源
┌─[localhost][~]
└──╼ cat /etc/yum.repos.d/docker.repo 
[docekr]
name=docker-centos7.7
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7.7/x86_64/stable/
enabled=1
gpgcheck=0

2、安装Docker-ce(社区免费版)

#这里我们安装Docker社区免费版
yum install -y docker-ce 
#安装完之后给Docker更换国内的镜像仓库
┌─[localhost][~]
└──╼ cat /etc/docker/daemon.json 
{
   
  "registry-mirrors": ["https://mch6oeq2.mirror.aliyuncs.com"]
}
#将docker设置为开机自启
┌─[localhost][~]
└──╼ systemctl enable --now docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
#查看服务是否启动
┌─[localhost][~]
└──╼ systemctl status docker
#docker的第一个镜像
┌─[localhost][~]
└──╼ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

二、Docker中的一些基础操作

1、运行第一个容器

#查看自己本地的镜像有哪些
┌─[localhost][~]<
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值