温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux系统中如何安装Docker容器

发布时间:2022-02-01 19:48:55 来源:亿速云 阅读:186 作者:小新 栏目:开发技术

小编给大家分享一下Linux系统中如何安装Docker容器,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

Docker容器作为一个全新的概念虽然广受关注,但是对于如何使用Docker,将容器技术真正落地用起来,目前估计很多人还没有非常清晰的思路。

1.CentOS

服务器的系统是CentOS7.4的 [root@VM_82_178_centos ~]# cat /etc/RedHat-releaseCentOS Linux release 7.4.1708 (Core)#安装依赖包yum install -y yum-utils device-mapper-persistent-data lvm2#添加Docker软件包源yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo#安装Docker CEyum install docker-ce -y#启动systemctl start docker#开机启动systemctl enable docker#查看Docker信息docker info

2.Ubuntu 上安装

apt-get update 安装证书: apt-get install \    apt-transport-https \    ca-certificates \    curl \    software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 添加docker源的key: sudo apt-key fingerprint 0EBFCD88 pub  4096R/0EBFCD88 2017-02-22      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88 uid                  Docker Release (CE deb) sub  4096R/F273FCD8 2017-02-22 添加docker软件包源: sudo add-apt-repository \  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \  $(lsb_release -cs) \  stable"跟新apt包索引: sudo apt-get update 安装docker ce apt-get install docker-ce

3.配置Docker加速器

Docker Hub 提供众多镜像,你可以从中自由下载数十万计的免费应用镜像, 这些镜像作为 docker 生态圈的基石,是我们使用和学习 docker 不可或缺的资源。为了解决国内用户使用 Docker Hub 时遇到的稳定性及速度问题 DaoCloud 推出永久免费的新一代加速器服务。 Linux:

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://bc437cce.m.daocloud.io [root@localhost ~]#  curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://bc437cce.m.daocloud.iodocker version >= 1.12 {"registry-mirrors": ["http://bc437cce.m.daocloud.io"]} Success. You need to restart docker to take effect: sudo systemctl restart docker [root@localhost ~]#[root@localhost ~]# systemctl  restart docker[root@localhost ~]# systemctl  stop docker[root@localhost ~]# ps -ef|grep dockerroot      15185  3300  0 01:39 pts/1    00:00:00 grep --color=auto docker [root@localhost ~]# systemctl  start docker[root@localhost ~]# ps -ef|grep dockerroot      15191      1  2 01:39 ?        00:00:00 /usr/bin/dockerd root      15198  15191  0 01:39 ?        00:00:00 docker-containerd --config /var/run/docker/containerd/containerd.toml root      15325  3300  0 01:39 pts/1    00:00:00 grep --color=auto docker [root@localhost ~]#


以上是“Linux系统中如何安装Docker容器”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI