【docker 入门 - 01】- Docker 在 Centos7 上安装与测试
一、学习文档
官网网站: https://www.docker.com
官方安装文档:https://docs.docker.com/install/linux/docker-ce/centos/
最好的文档和学习路劲,都是来自官方的一手资料!当然,文档写的不好的除外。。。
<注>:英文还能凑合的,尽量去官网安装,毕竟能够跟的上步伐!
这里的解释顺序按照普通的安装步骤走,可能会和官方顺序有点不同。
以下的安装步骤都需要网络的支持哦,如果实在虚拟机中安装的,注意要外网支撑哦!
二、OS requirements (系统要求)
To install Docker CE, you need a maintained version of CentOS 7. Archived versions aren’t supported or tested.
The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.
The overlay2 storage driver is recommended.
官方要求系统版本: Centos 7
安装的 Docker 为 docker-ce,即社区版
三、 Install using the repository(指定依赖的仓库)
这里,我们可以更新一下 yum 的依赖仓库。
SET UP THE REPOSITORY(设置依赖仓库)
1. Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
这里可能需要更新一下有关 yum 工具的一些依赖工具,比如 提供了 yum-config-manager (yum 配置管理)的工具 yum-utils,还有提供 设备持久化数据映射 与 1vm2 的 devicemapper 设备映射存储驱动。
更新命令如下:
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
2. Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or test repositories as well.
使用下面的命令来设置稳定版的仓库。
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
3. 这里只展示安装稳定版的,如果需要更多更详细的说明,请访问 docker 官方文档
四、 Uninstall old versions(卸载老旧的 docker 依赖)
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.
以前的老旧的 docker 版本叫做 docker 或者 docker-engine。这里你可能需要卸载这些老旧的依赖,卸载命令如下:
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. The Docker CE package is now called docker-ce.
五、INSTALL DOCKER CE(安装 docker 社区版,这个足够用了)
1. Install the latest version of Docker CE, or go to the next step to install a specific version:(如果你要安装最新的 docker-ce 版本,则直接使用下面的命令,如果需要指定某个版本,则先查看第 2 条说明)
$ sudo yum install docker-ce
注: 如果这里你指定了多个 docker 仓库,则可能安装到不是稳定的版本,具体查看官网信息。一般按照上面的步骤,是没有问题的,这里只是做一下说明。
2. To install a specific version of Docker CE, list the available versions in the repo, then select and install:(想要安装某个特定版本的 docker-ce,这里会列出你想要选择的 可用版本,这里从最高版本到最低版本为 从上到下展示,命令如下:)
$ yum list docker-ce --showduplicates | sort -r
展示出来的结果可能如下:
docker-ce.x86_64 18.09.0.ce-1.el7.centos docker-ce-stable
这是一个列表,一般会有多个版本,如果你想要安装某个特定的版本,则选择第二列,即 18.09.0.ce-1.el7.centos ,版本号为 “-” 这个短线前面的部分,比如这个的 18.09.0.ce,则安装命令如下:
这里需要指定你 docker-ce 的版本
$ sudo yum install docker-ce-18.09.0.ce
这个的原始命令为:
$ sudo yum install docker-ce-<VERSION STRING>,其中 <VERSION STRING> 为第二列 短线 “-” 前面的部分,组合起来,就可以安装到指定版本的 docker-ce。
六、Docker 启动测试
1. 启动 Docker
$ sudo systemctl start docker
2. Verify that docker is installed correctly by running the hello-world image.(通过运行 docker 界的 hello-world,来确认我们的 docker 安装是否正确)
$ sudo docker run hello-world
如图,出现图中红框内的文字,则代表 docker 安装成功了!

3. 如果想让 docker 设置开启激动,则命令如下:
$ sudo systemctl enable docker
七、Docker 简单命令及学习指导(其实我也是个菜鸡,但我觉着大方向不会错的)
查看 docker 中的信息,比如有多少个容器啊,镜像啊之类的,具体自己看。
docker info
学习 docker 命令,可以使用帮助命令查看手册,有什么命令不知道的,忘了的,可以通过下面的命令来查看
docker --help
如果想要查看某个命令的详细用法,则使用如下命令:(<command> 这个是你想要查询的某个命令)
docker <command> --help
八、如果你想要安装 阿里云的加速镜像
默认的加速镜像可能会比较慢,当然这个你可以自己决定,我用的程度也不是很深,也是借鉴别人的经验!
如果你没有阿里云账号,是可以通过支付宝直接注册登录的,毕竟都是一个体系的,放心用即可!
阿里云还有一个手机监控的 APP 哦,能直接在手机上输入命令,控制你的服务器,救急用还是挺好的,毕竟你不是时时刻刻都带着电脑到处跑吧,哈哈!
1. 在阿里云官网搜索栏中输入 “容器镜像服务”,会出现一个 “容器镜像服务 > 控制台”,直接点击进入
2. 左侧会有一个 “镜像加速器”,点击进去
3. “加速器地址” 下面的链接就是你的加速地址
4. 在 “操作文档” 一栏,选择你的系统,这里我们选择 “CentOS”
1. 安装 / 升级 Docker 客户端,一般不用管
2. 修改或者添加文件 /etc/docker/daemon.json
命令如下:
vim /etc/docker/daemon.json
内容修改为:(一看后面就像个数组,看是也是可以设置多个地址的啊,但是这里用一个就够了,多余的再说吧)
{
"registry-mirrors": ["这里是你的加速地址哦,千万不要写我"]
}
3. 让配置文件生效,并重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker
好了,docker 的安装与简单测试到这里就完成了!!!
祝各位好运!!!
祝各位好运!!!
祝各位好运!!!
转载请注明出处 【苏子九霄】,谢谢!
【docker 入门 - 01】- Docker 在 Centos7 上安装与测试的更多相关文章
- Centos7上安装docker (转)
Centos7上安装docker Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE. 社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如 ...
- Docker(2)--Centos7 上安装部署
Centos7 上安装docker Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE. 社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比 ...
- centos7上安装docker社区版
container(容器) docker(集装箱) 容器的优点 1. 启动速度快 2. 节省资源 3. 兼容性高 保证机器正常上网 #ping www.baidu.com CPU需要支持虚拟化 # g ...
- centos7上安装docker-ce社区版
报错:Error: docker-ce-selinux conflicts with 2:container-selinux-2.12-2.gite7096ce.el7.noarch 转载:http: ...
- 在 CentOS7 上安装 MySQL5.7
在 CentOS7 上安装 MySQL5.7 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建 ...
- 在CentOS7上安装和使用ZooKeeper最新版本(V3.4.12)
0.ZooKeeper文档 http://zookeeper.apache.org/doc/r3.4.11/zookeeperOver.html 1.准备 在CentOS7上安装zookeeper时, ...
- 在centos7上安装Jenkins
在centos7上安装Jenkins 安装 添加yum repos,然后安装 sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins ...
- 在 CentOS7 上安装 zookeeper-3.4.9 服务
在 CentOS7 上安装 zookeeper-3.4.9 服务 1.创建 /usr/local/services/zookeeper 文件夹: mkdir -p /usr/local/service ...
- 在 CentOS7 上安装 MongoDB
在 CentOS7 上安装 MongoDB 1 通过 SecureCRT 连接至 CentOS7 服务器: 2 进入到 /usr/local/ 目录: cd /usr/local 3 在当前目录下创建 ...
随机推荐
- thinkphp框架 的 链接数据库和操作数据
框架有时会用到数据库的内容,在"ThinkPhp框架知识"的那篇随笔中提到过,现在这篇随笔详细的描述下. 一.链接数据库 (1)找到模块文件夹中的Conf文件夹,然后进行编写con ...
- version `GLIBC_2.17' not found 解决方法
1.先查看是哪个函数用的是GLIBC_2.17 root@emb-pc:/home/emb/temp# nm lib61850.so | grep GLIBC_2.17 U clock_gettime ...
- java.util.concurrent包下集合类的特点与适用场景
java.util.concurrent包,此包下的集合都不允许添加null元素 序号 接口 类 特性 适用场景 1 Queue.Collection ArrayBlockingQueue 有界.阻塞 ...
- c#调用python代码
c#调用python的方法比较多,比如ironpython,尽管不用安装python环境,可是不兼容python众多的包,也只更新到了python2,通过创建python进程这种方式可以很好的解决兼容 ...
- intellij idea 导入mysql
我们先创建一个新的工程 下载包 下载完后测试一下连接 可以看到连接成功! 通过可视化工具查看本地的mysql的1234数据里面的数据
- OpenCV中 常用 函数 的作用
1.CV_Assert函数作用: CV_Assert()若括号中的表达式值为false,则返回一个错误信息.
- 一文洞悉Python必备50种算法!资深大牛至少得掌握25种!
一.环境需求 二.怎样使用 三.本地化 3.1扩展卡尔曼滤波本地化 3.2无损卡尔曼滤波本地化 3.3粒子滤波本地化 3.4直方图滤波本地化 四.映射 4.1高斯网格映射 4.2光线投射网格映射 4. ...
- 【学习】数据处理基础知识(缺失值处理)【pandas】
缺失数据(missing data)大部分数据分析应用中非常常见.pd设计目标之一就是让缺失数据的处理任务尽量轻松. pd 使用浮点值NaN(Not a Number) 表示浮点和非浮点数组中的缺失数 ...
- IntelliJ IDEA插件系列
参考: IntelliJ IDEA插件系列 1. activate-power-mode 和 Power mode II 根据Atom的插件activate-power-mode的效果移植到IDEA上 ...
- github 解决 Agent admitted failure to sign using the key
公司迁移git 新库,重新迁移数据. 添加 ssh key 1. 首先要在新git 库管理平台 添加新的ssh-key : 本机上执行 ssh-keygen -t rsa -C "Your ...