在这里我们使用的是docker的社区版Docker CE,针对的是未安装docker的新的主机,如果安装过docker的早期版本,先卸载它们及关联的依赖资源,安装的版本为docker 18.03。

  1、使用yum安装所需的软件包

[origalom@origalom ~]$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2

  2、设置 stable 镜像仓库

[origalom@origalom ~]$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

  3、启用edge 和 testing 镜像仓库

[origalom@origalom ~]$ sudo yum-config-manager --enable docker-ce-edge
[origalom@origalom ~]$ sudo yum-config-manager --enable docker-ce-test
[origalom@origalom ~]$ sudo yum-config-manager --disable docker-ce-edge # 禁用

  4、安装最新的CE

[origalom@origalom ~]$ sudo yum install docker-ce

  5、安装指定版本的CE

    在生产环境中,应安装特定版本的CE,而不是每次都使用最新版本。

[origalom@origalom ~]$ yum list docker-ce --showduplicates | sort -r    # 查找可用版本
[origalom@origalom ~]$ sudo yum install docker-ce-<VERSION STRING> # 安装指定版本

  6、启动docker

[origalom@origalom ~]$ sudo systemctl start docker

  7、验证是否安装成功

[origalom@origalom ~]$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:97ce6fa4b6cdc0790cda65fe7290b74cfebd9fa0c9b8c38e979330d547d22ce1
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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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://cloud.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

  此命令将下载一个测试镜像并在容器中运行它。容器运行时,它将输出一条参考消息并退出。

参考文档:

  docker中文社区

  docker官网

最新文章

  1. LCA---Tarjan算法
  2. [javaEE] 反射-通过反射了解集合泛型本质
  3. SSIS Dataflow使用存储过程不能检索列名
  4. linux 基本命令操作
  5. SUSE Linux 13服务器版
  6. JavaScript基于对象(面向对象)&lt;一&gt;类和对象
  7. ScaleGestureDetector缩放view
  8. C#界面设计疑问2:panel摆放问题
  9. Windows Server 中开启 SQL Server 2008 的1433端口
  10. 【Demo 0004】屏幕、窗体及视图基础知识
  11. poj 1654 Area(计算几何--叉积求多边形面积)
  12. Google主推-Android开发利器——Android Studio,这可能是最全的AS教程!
  13. asp.net core系列 55 IS4结合Identity密码保护API
  14. zkclient中包引用不对,导致NoSuchMethodError
  15. luogu P4146 序列终结者
  16. kafka6 编写使用自定义分区的生产者
  17. translate和position的比较
  18. SQL脚本运行
  19. CS100.1x-lab0_student
  20. git —— 标签

热门文章

  1. (原创)Stanford Machine Learning (by Andrew NG) --- (week 5) Neural Networks Learning
  2. Codeforces Round #114 (Div. 1) E. Wizards and Bets 高斯消元
  3. 推荐几个对象映射(Object-Object Map)的库
  4. phaser框架制作游戏的例子,加上自己的注释
  5. Boost::Lexical_cast 的使用
  6. 合并table相同单元格的插件(基于jquery的)
  7. WordPress &lt; 3.6.1 PHP 对象注入漏洞
  8. raymarching
  9. Python爬虫之一 PySpider 抓取淘宝MM的个人信息和图片
  10. 推断是否是有效的IP地址