02docker核心概念
1:docker三大核心概念
| 核心概念 | 描述 |
|---|---|
| 镜像 | Docker镜像类似于虚拟机镜像,可以将它理解为一个只读的模板。 |
| 容器 | Docker容器类似于一个轻量级的沙箱,Docker利用容器来运行和隔离应用。 容器是从镜像创建的应用运行实例。它可以启动、开始、停止、删除,而这些容器都是彼此相互隔离、互不可见的。 |
| 仓库 | Docker仓库类似于代码仓库,是Docker集中存放镜像文件的场所 |
区分:注册服务器和仓库

2:ubuntu下安装docker
安装docker前关闭selinux
手动添加软件源安装:
1:ubuntu@ubuntu:~$ uname -a #内核版本至少3.10才支持docker
Linux ubuntu 5.3.0-19-generic #20-Ubuntu SMP Fri Oct 18 09:04:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
2.安装如下两个软件包---让docker使用aufs存储
ubuntu@ubuntu:~$ sudo apt-get update
ubuntu@ubuntu:~$ sudo apt upgrade
ubuntu@ubuntu:~$ sudo apt install --reinstall linux-image-generic #重新升级到最新内核
ubuntu@ubuntu:~$ sudo apt install linux-modules-extra-$(uname -r) linux-image-extra-virtual
#linux-image-generic应该已经安装了相关的linux-image-extra包,但名称已更改为linux-modules-extra
以上操作解决报错:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-extra-5.3.0-19-generic
E: Couldn't find any package by glob 'linux-image-extra-5.3.0-19-generic'
E: Couldn't find any package by regex 'linux-image-extra-5.3.0-19-generic'
3:添加镜像源
-首先需要安装apt-transport-https等软件包
ubuntu@ubuntu:~$ sudo apt-get update
ubuntu@ubuntu:~$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
-添加源的gpg密钥
ubuntu@ubuntu:~$ curl -fsSL http://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
OK
-添加成功后
ubuntu@ubuntu:~$ sudo apt-get update
-开始安装docker
ubuntu@ubuntu:~$ sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'docker-ce' has no installation candidate
报错解决:
手动加入源
ubuntu@ubuntu:~$ cd /etc/apt/sources.list.d #进入到这个目录
ubuntu@ubuntu:/etc/apt/sources.list.d$ sudo vi docker.list #添加如下源
deb https://download.docker.com/linux/ubuntu zesty edge
ubuntu@ubuntu:/etc/apt/sources.list.d$ sudo apt update #更新源
ubuntu@ubuntu:~$ sudo apt install docker-ce # ----开始安装
安装完成后检查:
ubuntu@ubuntu:~$ docker version --检查是否安装成功
###配置docker服务
1.ubuntu@ubuntu:~$ sudo usermod -aG docker $USER #避免每次切换到sudo身份
2.Docker服务的默认配置文件为/etc/default/docker,可以通过修改其中的DOCKER_OPTS来修改服务启动的参数,例如让 Docker服务开启网络2375端口的监听:
DOCKER_OPTS="$DOCKER_OPTS -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"
###docker开启远程tcp监听端口
3.ubuntu@ubuntu:~$ sudo service docker restart 重启服务
官方提供的脚本安装:
sudo curl -sSL https://get.docker.com/ | sh
3:redhat7安装docker
关闭selinux
[root@registry ~]# getenforce
Enforcing
[root@registry ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
reboot
1:更新
[root@localhost ~]# yum install update
2:支持devicemapper存储类型
[root@localhost ~]# sudo yum install -y yum-utils device-mapper-persistent-data
3:添加docker稳定的yum软件源
[root@localhost ~]# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
4:更新yum软件源并安装
[root@localhost ~]# sudo yum update
5:安装
[root@localhost ~]#yum install install -y docker-ce
报错,有软件冲突
Error: initscripts conflicts with redhat-release-server-7.0-1.el7.x86_64
解决办法:
[root@localhost ~]# rpm -e redhat-release-server-7.0-1.el7.x86_64 --nodeps
再重新安装
[root@localhost ~]#yum install install -y docker-ce
安装完成后:
Docs: https://docs.docker.com
[root@localhost ~]# docker version
Client:
Version: 18.06.3-ce
API version: 1.38
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:26:51 2019
OS/Arch: linux/amd64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
有一个异常,只启动了client,server没有起来。
[root@localhost ~]# journalctl -xe |grep mkfs
Nov 13 18:10:14 localhost.localdomain dockerd[2567]: time="2019-11-13T18:10:14.159056463-05:00" level=info msg="Creating filesystem xfs on device docker-253:0-100841185-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-253:0-100841185-base]" storage-driver=devicemapper
Nov 13 18:10:14 localhost.localdomain dockerd[2616]: time="2019-11-13T18:10:14.646244369-05:00" level=info msg="Creating filesystem xfs on device docker-253:0-100841185-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-253:0-100841185-base]" storage-driver=devicemapper
Nov 13 18:10:15 localhost.localdomain dockerd[2644]: time="2019-11-13T18:10:15.165383379-05:00" level=info msg="Creating filesystem xfs on device docker-253:0-100841185-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-253:0-100841185-base]" storage-driver=devicemapper
Nov 13 18:15:30 localhost.localdomain dockerd[2692]: time="2019-11-13T18:15:30.268616422-05:00" level=info msg="Creating filesystem xfs on device docker-253:0-100841185-base, mkfs args: [-m crc=0,finobt=0 /dev/mapper/docker-253:0-100841185-base]" storage-driver=devicemapper
找到根本原因是:
mkfs.xfs版本太低,遂更新:
[root@localhost ~]# yum update xfsprogs #更新软件版本
[root@localhost ~]# systemctl start docker.service #重启docker服务
[root@localhost ~]# systemctl enable docker.service #配置开机启动
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost ~]# docker version
Client:
Version: 18.06.3-ce
API version: 1.38
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:26:51 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.3-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:28:17 2019
OS/Arch: linux/amd64
Experimental: false
02docker核心概念的更多相关文章
- 领域驱动设计(DDD)部分核心概念的个人理解
领域驱动设计(DDD)是一种基于模型驱动的软件设计方式.它以领域为核心,分析领域中的问题,通过建立一个领域模型来有效的解决领域中的核心的复杂问题.Eric Ivans为领域驱动设计提出了大量的最佳实践 ...
- Javascript本质第一篇:核心概念
很多人在使用Javascript之前都至少使用过C++.C#或Java,面向对象的编程思想已经根深蒂固,恰好Javascript在语法上借鉴了Java,虽然方便了Javascript的入门,但要深入理 ...
- [程序设计语言]-[核心概念]-02:名字、作用域和约束(Bindings)
本系列导航 本系列其他文章目录请戳这里. 1.名字.约束时间(Binding Time) 在本篇博文开始前先介绍两个约定:第一个是“对象”,除非在介绍面向对象语言时,本系列中出现的对象均是指任何可以有 ...
- spring技术核心概念纪要
一.背景 springframework 从最初的2.5版本发展至今,期间已经发生了非常多的修正及优化.许多新特性及模块的出现,使得整个框架体系显得越趋庞大,同时也带来了学习及理解上的困难. 本文阐述 ...
- ElasticSearch学习笔记-01 简介、安装、配置与核心概念
一.简介 ElasticSearch是一个基于Lucene构建的开源,分布式,RESTful搜索引擎.设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便.支持通过HTTP使用JSON进 ...
- Playmaker Input篇教程之引入的核心概念
Playmaker Input篇教程之引入的核心概念 Playmaker Input引入的核心概念 Playmaker引入了4个核心概念:状态机.动作.变量和事件.了解它们是学习操作Playmaker ...
- Maven的几个核心概念
POM (Project Object Model) 一个项目所有的配置都放置在 POM 文件中:定义项目的类型.名字,管理依赖关系,定制插件的行为等等.比如说,你可以配置 compiler 插件让它 ...
- 刀哥多线程GCD核心概念gcd
GCD GCD 核心概念 将任务添加到队列,并且指定执行任务的函数 任务使用 block 封装 任务的 block 没有参数也没有返回值 执行任务的函数 异步 dispatch_async 不用等待当 ...
- cocos2d-x一些核心概念截杀
Cocos2d-x中有很多概念,这些概念很多来源于动画.动漫和电影等行业,例如:导演.场景和层等概念,当然也有些有传统的游戏的概念.Cocos2d-x中核心概念:导演, 场景,层,节点,精灵,菜单动作 ...
随机推荐
- 实例分析jdom和dom4j的使用和区别 (转)
实例分析jdom和dom4j的使用和区别 对于xml的解析和生成,我们在实际应用中用的比较多的是JDOM和DOM4J,下面通过例子来分析两者的区别(在这里我就不详细讲解怎么具体解析xml,如果对于 ...
- sass 插值语句的使用
定义了一个 px 转 rem 的函数 @function remP($px) { @return $px / (750 / 15) * 1rem; } 在使用 calc 的时候想要使用函数求值的时候遇 ...
- DS-博客作业07
1.本周学习总结(0--2分) 1.1思维导图 1.2 谈谈你对查找运算的认识及学习体会. 在查找这一章,我学习的比较认真,但是还是有部分没太清楚.这章没有前一章树那么多的代码要记,但是还是要用心. ...
- zabbix自定义监控,自定义图表。
zabbix server:hostname=Zabbix server ip:192.168.100.7 zabbix agent: hostname=host3 ip:192.168.100.3 ...
- centos-Hadoop集群 安装同步时间
1.安装 yum search cache ntpdate xcall.sh "yum install -y ntpdate.x86_64" 2.同步 xcall.sh " ...
- POJ 2109 -- Power of Cryptography
Power of Cryptography Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 26622 Accepted: ...
- 2.JSON.stringify()Object
JSON.stringify() JSON 通常用于与服务端交换数据. 在向服务器发送数据时一般是字符串. 我们可以使用 JSON.stringify() 方法将 JavaScript 对象转换为字符 ...
- Going Deeper with Convolutions阅读摘要
论文链接:Going deeper with convolutions 代码下载: Abstract We propose a deep convolutional neural network ...
- tensorflow中一个矩阵和一个向量相加
import tensorflow as tf x=tf.constant([[1,2],[3,4]]) y=tf.constant([[1],[1]])#列向量 z=tf.constant([1,1 ...
- Linux终端中文显示乱码
今天,帮我们同学处理一下中文显示乱码的问题.这个是个国内Linux用户烦恼的问题,由于大部分的Linux发行版都是以英语为主体的,而且英文在通用性和稳定性上都比中文要好一些,各种奇怪的BUG也要少一点 ...