docker安装并设置开机启动(CentOS7/8)
CentOS7.2

docker分为CE和EE版本,EE版本收费,一般我们使用CE版本就满足要求了
docker安装及启动
docker安装很简单,直接使用如下命令安装即可,安装后的docker版本即为CE免费版(对于更高的linux版本,可以先执行安装docker-ce,如果提示Nothing to do,则再直接使用如下命令)
yum -y install docker
安装结束后,查看docker运行状态

启动docker

查看/var/log/messages日志,扎到如下错误信息
Aug :: localhost dockerd-current: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable selinux in docker (--selinux-enabled=false)
根据错误提示,修改docker配置文件,设置--selinux-enabled=false
vim /etc/sysconfig/docker

保存后,重新启动docker,查看启动状态

设置docker开机启动
docker安装之后,已经安装了开机启动service文件,但还需要在设置下开机启动,才能在服务器重启时自动启动
systemctl enable docker

CentOS8
查询docker
系统版本为Basic Web Server
[root@localhost ~]# yum search docker
Last metadata expiration check: :: ago on Sun Oct :: AM CST.
============================================================================== Summary & Name Matched: docker ===============================================================================
podman-docker.noarch : Emulate Docker CLI using podman
podman-docker.noarch : Emulate Docker CLI using podman
pcp-pmda-docker.x86_64 : Performance Co-Pilot (PCP) metrics from the Docker daemon
================================================================================== Summary Matched: docker ==================================================================================
oci-umount.x86_64 : OCI umount hook for docker
oci-systemd-hook.x86_64 : OCI systemd hook for docker
oci-systemd-hook.x86_64 : OCI systemd hook for docker
skopeo.x86_64 : Inspect Docker images and repositories on registries
这里没有我们想要的docker-ce
下载docker-ce repo
curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
安装docker
[root@localhost ~]# yum -y install docker-ce
Docker CE Stable - x86_64 6.5 kB/s | kB :
Error:
Problem: package docker-ce-:19.03.-.el7.x86_64 requires containerd.io >= 1.2.-, but none of the providers can be installed
- cannot install the best candidate for the job
- package containerd.io-1.2.-3.2.el7.x86_64 is excluded
- package containerd.io-1.2.-3.3.el7.x86_64 is excluded
- package containerd.io-1.2.-.el7.x86_64 is excluded
- package containerd.io-1.2.-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.-3.1.el7.x86_64 is excluded
- package containerd.io-1.2.-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
提示信息中告诉我们需要containerd.io依赖
yum -y install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm
再次安装docker(如果在安装docker-ce repo之前执行过yum -y install docker,则需要先执行yum remove docker卸载)
yum -y install docker-ce
启动docker
systemctl start docker
加入开机启动
systemctl enable docker
systemctl daemon-reload
查看docker版本
[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 19.03.
API version: 1.40
Go version: go1.12.10
Git commit: a872fc2f86
Built: Tue Oct ::
OS/Arch: linux/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 19.03.
API version: 1.40 (minimum version 1.12)
Go version: go1.12.10
Git commit: a872fc2f86
Built: Tue Oct ::
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.
GitCommit: fec3683
到此docker就安装完成了
docker安装并设置开机启动(CentOS7/8)的更多相关文章
- docker安装并设置开机启动(Linux)
docker 开机启动: systemctl enable docker 使用的linux系统为CentOS7.2 docker分为CE和EE版本,EE版本收费,一般我们使用CE版本就满足要求了 do ...
- CentOS7 nginx 最简单的安装以及设置开机启动
1. 下载tar包. 2. 解压缩tar包 3. 安装必须的部分 yum包 yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd ...
- docker容器怎么设置开机启动
https://my.oschina.net/lwenhao/blog/1923003 docker服务器.以及容器设置自动启动 一.docker服务设置自动启动 说明:适用于yum安装的各种服务 查 ...
- Linux上安装ZooKeeper并设置开机启动(CentOS7+ZooKeeper3.4.10)
1下载Zookeeper 2安装启动测试 2.1上载压缩文件并解压 2.2新建 zookeeper配置文件 2.3安装JDK 2.4启动zookeeper 2.5查看zookeeper的状态 3将Zo ...
- centos7安装redis设置开机启动
1. 首先下载redis源码,并使用tar进行解压缩 wget http://download.redis.io/releases/redis-4.0.8.tar.gztar xvzf redis-4 ...
- CentOS7.3编译安装Nginx设置开机启动
起因 最近想玩nginx了,本来用yum -y install nginx安装也启动好了,但是买了本<Nginx高性能Web服务器详解>,我咋能辜负我的书费呢?于是我就直接ps -ef | ...
- docker中怎样设置开机启动--随容器的启动而启动服务?
docker可以说给我们的部署带来极大的方便和可逢凶化吉性!(懂的同学自然懂) 在初步了解之后,我们就能简单使用docker了. 刚开始玩docker时,可以基于系统级别的镜像做定制,比如基于 ce ...
- redis安装并设置开机启动
1.下载并上传redis安装包至linux服务器目录:/usr/local/redis. 2.解压:tar -zxvf redis-5.0.7.tar.gz 3.编译安装:make && ...
- centos7安装docker并设置开机启动
版本要求:查看内核版本,需大于3.10 [root@localhost ~]# uname -r -.el7.x86_64 更新内核:如果是生产机器务必慎重更新内核,避免出现不必要的问题. sudo ...
随机推荐
- RobHess的SIFT环境配置
平台:win10 x64 +VS 2015专业版 +opencv-2.4.11 + gtk_-bundle_2.24.10_win32 参考博客:https://www.cnblogs.com/cql ...
- QTP10破解步骤(亲试有效)
QTP10破解步骤: 1.安装qtp,一路默认下来(一定要默认安装目录),一直到要求输入License的界面 2.拷贝mgn-mqt82.exe到C:\Program Files\Mercury In ...
- HTML5 离线缓存manifest
1.简介W3C官方对manifest的介绍是HTML5 引入了应用程序缓存,这意味着 web 应用可进行缓存,并可在没有因特网连接时进行访问. 应用程序缓存为应用带来三个优势: 离线浏览 - 用户可在 ...
- SpiderMan成长记(爬虫之路)
第一章 爬虫基础 1.1 爬虫基本原理 1.2 请求库 -- urllib库的使用 1.3 请求库 -- requests库的使用 1.4 数据解析 -- 正则基础 1.5 数据解析 -- lxml与 ...
- mailx使用465端口发邮件
centos上mailx通过465端口发送邮件 最近在看zabbix发送邮件的时候,发现自己的邮件总是无法发送,这里可能是外网防火墙禁止25端口,那么如何绕过25端口呢? 我使用的是163邮箱的 ...
- 编译teamtalk遇到的问题
一.编译log4cxx遇到的问题 1.error: narrowing conversion 这是在gcc-6下面一个官方的错误 解决方法 https://issues.apache.org/jira ...
- RunTime.getRunTime().addShutdownHook 添加钩子
Runtime.getRuntime().addShutdownHook(shutdownHook); google了一下它的含义:在jvm中增加一个关闭的钩子,当jvm关闭的时候,会执行系统中已经设 ...
- 给你自己的博客加个 Markdown
今天给大家推荐一个简单易用的开源 Markdown 组件, Markdown 组件仓库地址是: https://github.com/pandao/editor.md Markdown 是什么 Mar ...
- BZOJ 2178: 圆的面积并 (辛普森积分)
code #include <set> #include <cmath> #include <cstdio> #include <cstring> #i ...
- Huffman树、霍夫曼编码
Huffman树指的是带权路径长度WPL最小的二叉树 WPL=路径*权值 Huffman常用于压缩编码,正常传输ABCDEF这些字母需要3位二进制树来描述,但由于一篇文章中ABCDEF这些字母出现的概 ...