一、docker安装CentOS7
一、安装步骤
前提条件
Docker运行在CentOS7上,要求系统64位、系统内核版本为3.10以上。
Docker是一个进程,一启动就两个进程,一个服务,一个守护进程。占用资源就非常少,启动速度非常
1,root账户登录,查看内核版本如下
[root@localhost ~]# uname -a
Linux localhost.qgc 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
2、卸载旧版本(如果安装过旧版本的话)
$ sudo yum remove docker docker-common docker-selinux docker-engine
3、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4、加软件源
[liu@localhost ~]$ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo: yum-config-manager: command not found -----(表示依赖环境没有安装)
5、可以查看所有仓库中所有docker版本,并选择特定版本安装 (可选)
$ yum list docker-ce --showduplicates | sort -r
6:设置远程仓库
$sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
执行结果:
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
7、更新缓存
- yum makecache fast
8、安装docker
$ sudo yum install docker-ce
执行结果:
Loaded plugins: fastestmirror, langpacks
docker-ce-stable | 2.9 kB ::
docker-ce-stable/x86_64/primary_db | 4.8 kB ::
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 :17.03..ce-.el7.centos will be installed
--> Processing Dependency: docker-ce-selinux >= 17.03..ce-.el7.centos for package: docker-ce-17.03..ce-.el7.centos.x86_64
--> Processing Dependency: libcgroup for package: docker-ce-17.03..ce-.el7.centos.x86_64
--> Processing Dependency: libseccomp.so.()(64bit) for package: docker-ce-17.03..ce-.el7.centos.x86_64
--> Running transaction check
---> Package docker-ce-selinux.noarch :17.03..ce-.el7.centos will be installed
--> Processing Dependency: policycoreutils-python for package: docker-ce-selinux-17.03..ce-.el7.centos.noarch
---> Package libcgroup.x86_64 :0.41-.el7 will be installed
---> Package libseccomp.x86_64 :2.3.-.el7 will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 :2.5-.el7_3 will be installed
--> Processing Dependency: setools-libs >= 3.3.- for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: libsemanage-python >= 2.5- for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.- for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: libqpol.so.(VERS_1.)(64bit) for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: libqpol.so.(VERS_1.)(64bit) for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: libapol.so.(VERS_4.)(64bit) for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: libqpol.so.()(64bit) for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Processing Dependency: libapol.so.()(64bit) for package: policycoreutils-python-2.5-.el7_3.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 :2.6.-.el7_3. will be installed
---> Package checkpolicy.x86_64 :2.5-.el7 will be installed
---> Package libsemanage-python.x86_64 :2.5-5.1.el7_3 will be installed
---> Package python-IPy.noarch :0.75-.el7 will be installed
---> Package setools-libs.x86_64 :3.3.-1.1.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
docker-ce x86_64 17.03..ce-.el7.centos docker-ce-stable M
Installing for dependencies:
audit-libs-python x86_64 2.6.-.el7_3. update k
checkpolicy x86_64 2.5-.el7 base k
docker-ce-selinux noarch 17.03..ce-.el7.centos docker-ce-stable k
libcgroup x86_64 0.41-.el7 base k
libseccomp x86_64 2.3.-.el7 base k
libsemanage-python x86_64 2.5-5.1.el7_3 update k
policycoreutils-python x86_64 2.5-.el7_3 update k
python-IPy noarch 0.75-.el7 base k
setools-libs x86_64 3.3.-1.1.el7 base k Transaction Summary
=====================================================================================================================
Install Package (+ Dependent packages) Total download size: M
Installed size: M
Is this ok [y/d/N]: y
Downloading packages:
(/): audit-libs-python-2.6.-.el7_3..x86_64.rpm | kB ::
(/): checkpolicy-2.5-.el7.x86_64.rpm | kB ::
(/): libseccomp-2.3.-.el7.x86_64.rpm | kB ::
(/): libcgroup-0.41-.el7.x86_64.rpm | kB ::
(/): policycoreutils-python-2.5-.el7_3.x86_64.rpm | kB ::
(/): setools-libs-3.3.-1.1.el7.x86_64.rpm | kB ::
(/): libsemanage-python-2.5-5.1.el7_3.x86_64.rpm | kB ::
(/): python-IPy-0.75-.el7.noarch.rpm | kB ::
warning: /var/cache/yum/x86_64//docker-ce-stable/packages/docker-ce-selinux-17.03..ce-.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-selinux-17.03..ce-.el7.centos.noarch.rpm is not installed
(/): docker-ce-selinux-17.03..ce-.el7.centos.noarch.rpm | kB ::
(/): docker-ce-17.03..ce-.el7.centos.x86_64.rpm | MB ::
---------------------------------------------------------------------------------------------------------------------
Total MB/s | MB ::
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libcgroup-0.41-.el7.x86_64 /
Installing : setools-libs-3.3.-1.1.el7.x86_64 /
Installing : checkpolicy-2.5-.el7.x86_64 /
Installing : libsemanage-python-2.5-5.1.el7_3.x86_64 /
Installing : audit-libs-python-2.6.-.el7_3..x86_64 /
Installing : python-IPy-0.75-.el7.noarch /
Installing : policycoreutils-python-2.5-.el7_3.x86_64 /
Installing : docker-ce-selinux-17.03..ce-.el7.centos.noarch /
setsebool: SELinux is disabled.
libsemanage.semanage_direct_install_info: Overriding docker module at lower priority with module at priority .
Installing : libseccomp-2.3.-.el7.x86_64 /
Installing : docker-ce-17.03..ce-.el7.centos.x86_64 /
Verifying : libseccomp-2.3.-.el7.x86_64 /
Verifying : python-IPy-0.75-.el7.noarch /
Verifying : audit-libs-python-2.6.-.el7_3..x86_64 /
Verifying : libsemanage-python-2.5-5.1.el7_3.x86_64 /
Verifying : docker-ce-selinux-17.03..ce-.el7.centos.noarch /
Verifying : libcgroup-0.41-.el7.x86_64 /
Verifying : policycoreutils-python-2.5-.el7_3.x86_64 /
Verifying : docker-ce-17.03..ce-.el7.centos.x86_64 /
Verifying : checkpolicy-2.5-.el7.x86_64 /
Verifying : setools-libs-3.3.-1.1.el7.x86_64 / Installed:
docker-ce.x86_64 :17.03..ce-.el7.centos Dependency Installed:
audit-libs-python.x86_64 :2.6.-.el7_3. checkpolicy.x86_64 :2.5-.el7
docker-ce-selinux.noarch :17.03..ce-.el7.centos libcgroup.x86_64 :0.41-.el7
libseccomp.x86_64 :2.3.-.el7 libsemanage-python.x86_64 :2.5-5.1.el7_3
policycoreutils-python.x86_64 :2.5-.el7_3 python-IPy.noarch :0.75-.el7
setools-libs.x86_64 :3.3.-1.1.el7 Complete!
九、启动docker并加入开机启动
$ sudo systemctl start docker
$ sudo systemctl enable docker 或者(推荐上面的)
$ sudo service docker start
service docker start #启动docker
chkconfig docker on #加入开机启动
十、验证安装是否成功(有client和service两部分表示docker安装启动都成功了)
docker version
十一、测试容器
sudo docker run hello-world #基于hello-world镜像启动一个容器,如果本地没有镜像会从公网拉取过来,这次做为测试用
sudo docker info #查看信息
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
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.
. 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/
二、问题
1、因为之前已经安装过旧版本的docker,在安装的时候报错如下:
Transaction check error:
file /usr/bin/docker from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
file /usr/bin/docker-containerd from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
file /usr/bin/docker-containerd-shim from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
file /usr/bin/dockerd from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
2、卸载旧版本的包
$ sudo yum erase docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
3、再次安装docker
$ sudo yum install docker-ce
一、docker安装CentOS7的更多相关文章
- Docker安装 - CentOS7环境
Docker安装 - CentOS7环境 安装Docker 我是虚拟机装的Centos7,linux 3.10 内核,docker官方说至少3.8以上,建议3.10以上(ubuntu下要linux内核 ...
- Docker 安装(centos7下)
下面链接为官方的安装方法(官方的是最好的): https://docs.docker.com/install/linux/docker-ce/centos/#upgrade-docker-after- ...
- docker 安装centos7并SSH远程连接
1.安装centos7 镜像 1.搜索并拉取centos镜像(默认最新镜像) docker search centos docker pull centos 2.建立本机对应docker-centos ...
- win系统下之docker安装centos7镜像
1) 拉取镜像 输入命令docker pull centos:7 从仓库拉取centos7的镜像 2) 查看本地镜像 命令:docker images 可以查看已经把centos的镜像拉取 ...
- Docker安装CentOS7
1. 拉取镜像 docker pull centos:centos7 2. 启动镜像创建容器 docker run -d -p 36622:22 -p 36680:80 --name centos7- ...
- docker安装centos7镜像
拉取centos7镜像[root@localhost ~]# docker pull centos:71启动镜像centos7,如果不指定 /bin/bash,容器运行后会自动停止[root@loca ...
- docker安装CentOS7及JNI使用相关过程记录
docker pull centos:centos7(拉取镜像) docker run -itd --name centos-test centos:centos7 (运行容器) docker exe ...
- docker安装-centos7
操作系统要求 要安装Docker,您需要64位版本的CentOS 7.步骤: 卸载旧版本 Docker的旧版本被称为docker或docker-engine . 如果这些已安装,请卸载它们以及关联 ...
- linux上docker安装centos7.2
1.安装 docker pull centos:7.2.1511 2.启动镜像 docker run -d -i -t <IMAGE ID> /bin/bash 3.进入容器 docker ...
随机推荐
- (九)SpringBoot之错误处理
一.错误处理方法 1.Spring Boot 将所有的错误默认映射到/error, 实现ErrorController 2.添加自定义的错误页面 二.Spring Boot 将所有的错误默认映射到 ...
- 写给Web开发人员看的Nginx介绍
译者注:不知道其他开发者是否和我一样,参与或者写了很多Web项目,但是却没有真正的去完整的部署应用,很多时候都是交给ops即运维的同学帮忙来做.而作为一个有节操的开发者,我认为了解一些服务器方面的知识 ...
- QT实现两条贪吃蛇
Snake.pro文件 1 #------------------------------------------------- 2 # 3 # Project created by QtCreato ...
- cli中webpack的配置详解
一.前言 vue-cli是构建vue单页应用的脚手架,输入一串指定的命令行从而自动生成vue.js+wepack的项目模板.这其中webpack发挥了很大的作用,它使得我们的代码模块化,引入一些插件帮 ...
- 理解JVM之垃圾回收
1.垃圾收集算法 1) 标记-清楚算法:该算法是最基础的收集算法,其分为标记与清除两个阶段.首先标记出所有需要回收的对象,在标记完成后统一回收所有被标记的对象,该算法主要有两个不足:一个是效率问题,标 ...
- Neutron服务组件
OpenStack 项目中的Neutron 网络服务组件中提供虚拟机实例对网络的连接,其中plug-ins 能够提供对多种网络设备和软件的支持,使OpenStack 环境的构建和部署具备更多的灵活性, ...
- Windows10关闭自动更新方法
你在为windows10自动更新而烦恼吗?下面教你一招如何关闭自动更新
- U盘装manjaro 18报Python error in job “initcpio”
更新: 还是不行,大家再找别的方法. 以下内容仅做参考,意义不大. U盘安装 用rufus做U盘,写入选DD模式,比ISO模式可靠点. 错误解决 报错信息: Error installing Manj ...
- springbatch
springbatch job的创建使用 job:作业,是批处理中的核心概念,是batch操作的基础单元,每个job由多个step组成 step:步骤,任务完成的节点 每个job是由JobBuildF ...
- java-集合处理数据的效率差异
先给结论,ArrayList数组结构的,插入和删除耗时长,get(index)耗时短. LinkedList是链表结构的,插入和删除耗时短,get(index)耗时长. 常用的几种集合,ArrayLi ...