前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >docker安装(CentOS 7)

docker安装(CentOS 7)

作者头像
ByteBye
发布2019-09-24 16:48:39
9850
发布2019-09-24 16:48:39
举报
文章被收录于专栏:ByteByeByteBye

docker

一、yum安装docker(CentOS 7)

  • Docker CE 即社区免费版,Docker EE 即企业版,强调安全,但需付费使用。
  • 下面是Docker CE的安装使用
  1. 移除旧的版本: $ 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
  2. 安装一些必要的系统工具: $ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  3. 添加软件源信息: $ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  4. 更新 yum 缓存: $ sudo yum makecache fast
  5. 安装 Docker-ce: $ sudo yum -y install docker-ce
  6. 启动 Docker 后台服务 $ sudo systemctl start docker
  7. 测试运行 hello-world [root@localhost docker]# docker run hello-world 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

  1. 使用 sudo 或 root 权限登录 Centos。
  2. 确保 yum 包更新到最新。 $ sudo yum update
  3. 执行 Docker 安装脚本。 $ curl -fsSL https://get.docker.com -o get-docker.sh $ sudo sh get-docker.sh
    • 执行这个脚本会添加 docker.repo 源并安装 Docker。
  4. 启动 Docker 进程 $ sudo systemctl start docker
  5. 验证 docker 是否安装成功并在容器中执行一个测试的镜像。 $ sudo docker run hello-world

三、镜像加速

四、删除 Docker CE

  • 执行以下命令来删除 Docker CE: $ sudo yum remove docker-ce $ sudo rm -rf /var/lib/docker

本文由 bytebye 创作 本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-11-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、yum安装docker(CentOS 7)
  • 二、使用脚本安装 Docker
  • 三、镜像加速
  • 四、删除 Docker CE
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档