资讯专栏INFORMATION COLUMN

Docker-CE 入门

libin19890520 / 1577人阅读

摘要:记录作者是我关于的实践记录,该实践的构建环境以下配置源的作用是添加文件注意速度有点慢开启指定部分更新缓存部署指定版本本地部署下载地址注意的依赖可以使用国内源,我配

Docker Action 记录 作者: LinkSystem 2017/08/11

Docker Action 是我关于Docker-CE的实践记录,该实践的构建环境以下:

[root@core ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

[root@core ~]# docker version
Client:
 Version:      17.07.0-ce-rc2
 API version:  1.31
 Go version:   go1.8.3
 Git commit:   36ce605
 Built:        Mon Aug  7 23:43:46 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.07.0-ce-rc2
 API version:  1.31 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   36ce605
 Built:        Mon Aug  7 23:45:07 2017
 OS/Arch:      linux/amd64
 Experimental: false

配置Yum

# yum-utils的作用是添加 repo 文件
[root@core ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# 注意速度有点慢
[root@core ~]# sudo yum-config-manager 
>     --add-repo 
>     https://download.docker.com/linux/centos/docker-ce.repo
# 开启指定部分 repo
[root@core ~]# sudo yum-config-manager --enable docker-ce-edge
[root@core ~]# sudo yum-config-manager --enable docker-ce-test
# 更新缓存
[root@core ~]# sudo yum makecache fast

部署 Docker-CE

[root@core ~]# sudo yum install docker-ce

# 指定版本
# [root@core ~]# yum list docker-ce.x86_64  --showduplicates | sort -r
# sudo yum install docker-ce-

本地部署

# RPM下载地址: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
# 注意:Docker-CE 的依赖可以使用国内 Yum 源, 我配置的是阿里云的源
[root@core ~]# sudo yum install docker-ce/docker-ce-17.07.0.ce-0.2.rc2.el7.centos.x86_64.rpm

配置 Docker-CE

[root@core ~]# sudo systemctl start   docker
[root@core ~]# sudo systemctl enable  docker
# 配置 Docker 加速器
[root@core ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://df98fb04.m.daocloud.io
[root@core ~]# sudo systemctl restart docker

测试

[root@core ~]# sudo docker run hello-world
Unable to find image "hello-world:latest" locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete 
Digest: sha256:9a4ec8dac439d00fff31bf41b23902bfd7f7465d4b4c8c950e572e7392f33c66
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.
 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://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

部署脚本

[root@core ~]# curl -fsSL get.docker.com -o get-docker.sh
[root@core ~]# sudo sh get-docker.sh

卸载 Docker-CE

# Docker 旧版本
[root@core ~]# sudo yum remove docker 
>                   docker-common 
>                   docker-selinux 
>                   docker-engine
# Docker-CE 版本
[root@core ~]# sudo yum remove docker-ce
[root@core ~]# sudo rm -rf /var/lib/docker

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/27003.html

相关文章

  • Docker入门学习

    摘要:如无论哪个服务器,下载的文件内容是一样的。如果需要启动,通过命令执行完后,再打开文件,可以看到的了。 docker的官网:https://www.docker.com/官方文档:https://docs.docker.com/github: https://github.com/docker/lab... Docker类似虚拟机,是一个开源的引擎,可以轻松的为任何应用创建一个轻量级的、...

    xiaodao 评论0 收藏0
  • Docker入门(二)

    摘要:下面给出了其中几个子命令。将指定名称的容器拉取到系统中。列出正在运行的容器。起初只是之上的一个软件层但现在已经演化成为一个独立的系统。服务器的主要配置文件位于和参考从构建镜像命令的用法 检查安装情况 centos7下 // 删除旧版本和相关依赖 yum remove docker docker-client d...

    Airy 评论0 收藏0
  • 这是一次 docker 入门实践

    摘要:前言其实接触也有一段时间了,但是一直没有做下总结,现在网上关于的介绍也有很多了,本着好记性不如烂笔头的原则,还是自己再记录一波吧。实现目标安装探索基本概念及用法环境准备位,内核版本不低于安装以下命令均需在权限下执行。 showImg(https://segmentfault.com/img/remote/1460000017894270?w=538&h=344); 前言 其实接触 do...

    ashe 评论0 收藏0
  • Docker入门

    摘要:隔离的进程独立于宿主和其它的隔离的进程。容器可以被创建启动停止删除暂停等。添加内核参数使用看到下面的这些警告信息解决方法内核配置参数以启用这些功能。然后重新加载 Docker简介 Docker 是使用 Go 语言 进行开发实现,基于 Linux 内核的 cgroup,namespace,以及 AUFS 类的 Union FS 等技术,对进程进行封装隔离,属于 操作系统层面的虚拟化技...

    netScorpion 评论0 收藏0
  • Docker入门

    摘要:隔离的进程独立于宿主和其它的隔离的进程。容器可以被创建启动停止删除暂停等。添加内核参数使用看到下面的这些警告信息解决方法内核配置参数以启用这些功能。然后重新加载 Docker简介 Docker 是使用 Go 语言 进行开发实现,基于 Linux 内核的 cgroup,namespace,以及 AUFS 类的 Union FS 等技术,对进程进行封装隔离,属于 操作系统层面的虚拟化技...

    Benedict Evans 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<