docker安装部署

   🔥 推荐专栏《DevOps本地化方案》

centos 7安装

1.在 CentOS 7安装docker要求系统为64位、系统内核版本为 3.10 以上

可以使用以下命令查看:uname -r

uname -r

2.查看是否已安装docker列表:yum list installed | grep docker,什么都不提示说明咱们还没有安装

3.安装docker:yum -y install docker

yum -y install docker

4.启动dock   systemctl start docker

systemctl start docker

5.查看服务状态是否启动

如下图就说明启动成功了:systemctl status docker

systemctl status docker

以上出来的Active(running)就说明你的docker安装成功,你可以自己安装你自己需要使用的工具了

6.设置开机自动启动命令:systemctl enable docker.service

systemctl enable docker.service

centos8 AnoliOS 安装

更新yum

yum -y update

依赖

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

添加 Docker 源

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

安装

sudo yum install docker-ce docker-ce-cli containerd.io --nobest

启动 Docker CE

sudo systemctl enable docker

sudo systemctl start docker

建立用户组

一般我们不会直接用 root 这个大权限的用户来操作,一般需要建立一个组加入 docker 组:

sudo groupadd docker

将当前用户加入 docker 组

sudo usermod -aG docker $USER

忒出当前客户端重新登录,进行下面的测试

Docker 镜像

由于某些原因,我们访问外网很慢,甚至是无法访问,好在有大厂这个镜像,所以赶紧换之。

新建一个配置文件 /etc/docker/daemon.json

vi /etc/docker/daemon.json

输入以下内容:

{

"registry-mirrors": [

"https://dockerhub.azk8s.cn",

"https://hub-mirror.c.163.com"

]

}

改完一定要重启!改完一定要重启!改完一定要重启!

sudo systemctl daemon-reload

sudo systemctl restart docker

测试 Docker 是否安装成功

执行以下命令:

docker run hello-world

输出:

Hello from Docker!

This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
  3. The Docker daemon created a new container from that image which runs the
  4. The Docker daemon streamed that output to the Docker client, which sent it
  • 9
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值