【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 在当前目录下创建 ...
随机推荐
- [蓝桥杯]PREV-21.历届试题_回文数字
问题描述 观察数字:, 都有一个共同的特征,无论从左到右读还是从右向左读,都是相同的.这样的数字叫做:回文数字. 本题要求你找到一些5位或6位的十进制数字.满足如下要求: 该数字的各个数位之和等于输入 ...
- Elasticsearch-6.7.0系列(五)5044端口 logstash安装
centos7环境 下载logstash wget https://artifacts.elastic.co/downloads/logstash/logstash-6.7.0.tar.gz ...
- 菲律宾Globe/TM卡最省钱的上网方案
基本技能点 1:发送SURFALERT ON到8080,这样就关掉了余额扣费的上网方式,防止因为套餐耗尽后疯狂扣话费. 2:用Coins.ph充个15Pisos(也就2元人民币),或则充多点钱都可以. ...
- JAVA\Android 多线程实现方式及并发与同步
转载:https://blog.csdn.net/csdn_aiyang/article/details/65442540 概述 说到线程,就不得不先说线程和进程的关系,这里先简单解释一下,进 ...
- [UE4]引用Grabbable接口
一.当前:可抓取对象的类型是GrabTargetActor 二.修改目标:可抓取对象的类型改成Grabbable. 1.Fand Grab Target的返回值改成Grabbale(变量的数据类型可以 ...
- javascript多语言设定方式
1.控件文字语言设定 1.1 设定两个结构变量,定义好每一个控件需要用到的值,称它字典对象 var languagecn = { 1089: "夹柄不到位", 1090: &quo ...
- Activation error occured while trying to get instance of type Database,key ""之Oracle
我在发布web项目时好几次好遇到这个问题,查看了别人的说法,感觉还是不能解决,后来发现在发布时bin里面有dll没有打包到发布文件的bin目录中,而这些dll又是在连接Oracle(我选择的Oracl ...
- 【Python爬虫】01:网络爬虫--规则
Python网络爬虫与信息提取 目标:掌握定向网络数据爬取和网页解析的基本能力. the website is the API 课程分为以下部分: 1.requsets库(自动爬取HTML页面.自动网 ...
- node_api学习之http
node模块学习-http 理解 HTTP构建于TCP之上,属于应用层协议,继承自tcp服务器(net模块),它能与多个客户端保持连接,由于基于事件驱动,并不为每个连接创建额外的进程或线程,所以能实现 ...
- python向config、ini文件读取写入
config读取操作 cf = configparser.ConfigParser() # 实例化对象 cf.read(filename) # 读取文件 cf.sections() # 读取secti ...