系统要求

本安装教程仅限于CentOS7,其他系统不适用。
centos-extras仓库必须是启用状态,这个仓库默认状态是启用,如果不是启用状态,请修改。

卸载旧版本的Docker

Docker的旧版本叫做docker或者docker-engine。现在的Docker版本是Docker CE(社区版)和Docker EE(企业版)。一般情况下,咱们使用Docker CE(社区版)就可以了。如果你的系统安装了旧版本,卸载它们以及与它们相关的依赖。命令如下:

$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

  

如果你的系统中没有安装旧版本的Docker,将会出现如下提示:

已加载插件:fastestmirror
参数 docker 没有匹配
参数 docker-client 没有匹配
参数 docker-client-latest 没有匹配
参数 docker-common 没有匹配
参数 docker-latest 没有匹配
参数 docker-latest-logrotate 没有匹配
参数 docker-logrotate 没有匹配
参数 docker-engine 没有匹配
不删除任何软件包

安装Docker

如果你是在主机上第一次安装Docker CE,需要设置Docker的仓库。以后就可以从这个仓库安装和更新Docker了。

设置仓库

  • 安装所需的包,yum-utils提供yum-config-manager工具,device-mapper-persistent-datalvm2devicemapper存储驱动所需要的。安装命令如下:
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
  • 通过如下的命令设置稳定的仓库
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

安装Docker CE

  • 安装最新版本的Docker CE
$ sudo yum install docker-ce docker-ce-cli containerd.io

命令完成后,Docker已经安装,但是并没有启动。

  • 启动Docker
$ sudo systemctl start docker
  • 通过运行hello-world镜像验证Docker CE是否安装成功。
$ sudo docker run hello-world

运行结果如下:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:92695bc579f31df7a63da6922075d0666e565ceccad16b59c3374d2cf4e8e50e
Status: Downloaded newer image for hello-world:latest 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.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal. To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/get-started/

表示安装成功。

Docker的卸载

  • 卸载Docker包
$ sudo yum remove docker-ce
  • 镜像、容器、自定义配置文件等并不会随着Docker的卸载自动删除,你需要执行一下命令手动删除:
$ sudo rm -rf /var/lib/docker

到这里,Docker的安装与卸载过程就给大家介绍完了。

Docker在linux系统下的安装的更多相关文章

  1. linux系统下怎么安装.deb文件

    linux系统下怎么安装.deb文件? deb 是 ubuntu .debian 的格式.rpm 是 redhat .fedora .suse 的格式. 他们不通用(虽然可以转换一下). deb是de ...

  2. linux系统下怎么安装.deb文件?

    linux系统下怎么安装.deb文件? deb 是 ubuntu .debian 的格式. rpm 是 redhat .fedora .suse 的格式. 他们不通用(尽管能够转换一下). deb是d ...

  3. Linux 系统下Eclipse安装及使用

    Linux 系统下Eclipse安装及使用 我们在搞上层开发的时候,都是在Windows下使用Eclipse,那么如果是Linux应用开发,就必须要在Linux中安装Eclipse,用于C/C++开发 ...

  4. linux系统下nginx安装目录和nginx.conf配置文件目录

    linux系统下nginx安装目录和nginx.conf配置文件目录 1.查看nginx安装目录 输入命令 # ps  -ef | grep nginx 返回结果包含安装目录 root      26 ...

  5. Linux系统下Dubbo安装的详细教程

    Linux系统下Dubbo安装的详细教程 1.Dubbo的简介 Dubbo是 [1]  阿里巴巴公司开源的一个高性能优秀的服务框架,使得应用可通过高性能的 RPC 实现服务的输出和输入功能,可以和 [ ...

  6. Linux系统下Redis安装(一)

    最近项目要使用Redis,特将这段时间将Redis的学习经验与大家分享,算是对这段时间学习成果的总结和技术提炼,不足之处还望大家批评指正. 项目背景: 有些很少改动的数据和经常使用的数据(例如系统中下 ...

  7. linux系统下手动安装Angular-cli

    安装Angular-cli 背景 由于公司linux服务器没有外网,无法通过npm包管理器直接安装,只能手动安装一个Angular-cli平台环境! 安装步骤 1. 先再linux系统下安装好node ...

  8. linux系统下jdk安装配置

    1.有jdk包(linux版) 2.放到linux系统下 3.建议在usr下新建jdk目录之后将jdk文件放到该目录下 3.配置系统信息   /etc/profile 需要配置的信息如下:#set j ...

  9. Linux系统下Redis安装(二)

    上一篇随笔,已经成功开启了Redis-server,客户端已经可以正常对redis进行正常操作. 但是,redis-server开启的同时,一个大大doc黑屏也在那里开启着,接下来就对讲解如何在Lin ...

随机推荐

  1. QT多线程中使用QTcpSocket遇到的读写数据问题

    多线程中使用QTcpSocket在run()方法中new QTcpSocket;然后监听readyRead()信号connect(m_pTcpSocket,SIGNAL(readyRead()),th ...

  2. QT POST/GET HTTP操作

    工程文件 Qt += network 举例 Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui-> ...

  3. Keepalived与MySQL互为主从自动切换配置

    为解决Mysql数据库单点问题,实现两台MySQL数据库互为主备,双向replication.当一Master出现问题,则将Slave切换为Master继续工作. 环境说明 系统版本:CentOS L ...

  4. bokeh 中 ValueError: Unrecognized range input: 解决方法

    bokeh_data.index =bokeh_data.index.astype(np.str) 将其转换为字符型

  5. MySQL 重要参数 innodb_flush_log_at_trx_commit 和 sync_binlog

    innodb_flush_log_at_trx_commit 主要控制了innodb将log buffer中的数据写入日志文件并flush磁盘的时间点,取值分别为0.1.2三个.该参数控制重做日志写入 ...

  6. Collaborative Spatioitemporal Feature Learning for Video Action Recognition

    Collaborative Spatioitemporal Feature Learning for Video Action Recognition 摘要 时空特征提取在视频动作识别中是一个非常重要 ...

  7. JAVA类与类之间的关系及代码示例

    参考链接:https://blog.csdn.net/wq6ylg08/article/details/81092056

  8. sublime python 配置内容

    {"cmd": ["python", "-u", "$file"],"file_regex": &q ...

  9. ThinkPHP获取当前页URL添加canonical

    最近ytkah正在开发一个thinkPHP项目,数据量有点大,很多页面都没被索引,需要对模板进行修改,首先需要改的是页面唯一性,因为产品页加入购物车等行为会带有一些参数,如果不加入canonical标 ...

  10. Navicat Premium永久激活方式

    今天安装完Navicat Premium,运行时出现只能用14天的信息,所以就比较生气,只能用14天,那我还下你干啥,所以就查教程,弄了个破解工具,最后大功告成,应该是可以永久使用了,具体的教程看下 ...