docker运行环境安装-centos(一)
2024-08-27 14:28:39
在这里我们使用的是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/
此命令将下载一个测试镜像并在容器中运行它。容器运行时,它将输出一条参考消息并退出。
参考文档:
最新文章
- LCA---Tarjan算法
- [javaEE] 反射-通过反射了解集合泛型本质
- SSIS Dataflow使用存储过程不能检索列名
- linux 基本命令操作
- SUSE Linux 13服务器版
- JavaScript基于对象(面向对象)<;一>;类和对象
- ScaleGestureDetector缩放view
- C#界面设计疑问2:panel摆放问题
- Windows Server 中开启 SQL Server 2008 的1433端口
- 【Demo 0004】屏幕、窗体及视图基础知识
- poj 1654 Area(计算几何--叉积求多边形面积)
- Google主推-Android开发利器——Android Studio,这可能是最全的AS教程!
- asp.net core系列 55 IS4结合Identity密码保护API
- zkclient中包引用不对,导致NoSuchMethodError
- luogu P4146 序列终结者
- kafka6 编写使用自定义分区的生产者
- translate和position的比较
- SQL脚本运行
- CS100.1x-lab0_student
- git —— 标签
热门文章
- (原创)Stanford Machine Learning (by Andrew NG) --- (week 5) Neural Networks Learning
- Codeforces Round #114 (Div. 1) E. Wizards and Bets 高斯消元
- 推荐几个对象映射(Object-Object Map)的库
- phaser框架制作游戏的例子,加上自己的注释
- Boost::Lexical_cast 的使用
- 合并table相同单元格的插件(基于jquery的)
- WordPress <; 3.6.1 PHP 对象注入漏洞
- raymarching
- Python爬虫之一 PySpider 抓取淘宝MM的个人信息和图片
- 推断是否是有效的IP地址