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核心概念的更多相关文章

  1. 领域驱动设计(DDD)部分核心概念的个人理解

    领域驱动设计(DDD)是一种基于模型驱动的软件设计方式.它以领域为核心,分析领域中的问题,通过建立一个领域模型来有效的解决领域中的核心的复杂问题.Eric Ivans为领域驱动设计提出了大量的最佳实践 ...

  2. Javascript本质第一篇:核心概念

    很多人在使用Javascript之前都至少使用过C++.C#或Java,面向对象的编程思想已经根深蒂固,恰好Javascript在语法上借鉴了Java,虽然方便了Javascript的入门,但要深入理 ...

  3. [程序设计语言]-[核心概念]-02:名字、作用域和约束(Bindings)

    本系列导航 本系列其他文章目录请戳这里. 1.名字.约束时间(Binding Time) 在本篇博文开始前先介绍两个约定:第一个是“对象”,除非在介绍面向对象语言时,本系列中出现的对象均是指任何可以有 ...

  4. spring技术核心概念纪要

    一.背景 springframework 从最初的2.5版本发展至今,期间已经发生了非常多的修正及优化.许多新特性及模块的出现,使得整个框架体系显得越趋庞大,同时也带来了学习及理解上的困难. 本文阐述 ...

  5. ElasticSearch学习笔记-01 简介、安装、配置与核心概念

    一.简介 ElasticSearch是一个基于Lucene构建的开源,分布式,RESTful搜索引擎.设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便.支持通过HTTP使用JSON进 ...

  6. Playmaker Input篇教程之引入的核心概念

    Playmaker Input篇教程之引入的核心概念 Playmaker Input引入的核心概念 Playmaker引入了4个核心概念:状态机.动作.变量和事件.了解它们是学习操作Playmaker ...

  7. Maven的几个核心概念

    POM (Project Object Model) 一个项目所有的配置都放置在 POM 文件中:定义项目的类型.名字,管理依赖关系,定制插件的行为等等.比如说,你可以配置 compiler 插件让它 ...

  8. 刀哥多线程GCD核心概念gcd

    GCD GCD 核心概念 将任务添加到队列,并且指定执行任务的函数 任务使用 block 封装 任务的 block 没有参数也没有返回值 执行任务的函数 异步 dispatch_async 不用等待当 ...

  9. cocos2d-x一些核心概念截杀

    Cocos2d-x中有很多概念,这些概念很多来源于动画.动漫和电影等行业,例如:导演.场景和层等概念,当然也有些有传统的游戏的概念.Cocos2d-x中核心概念:导演, 场景,层,节点,精灵,菜单动作 ...

随机推荐

  1. 巨丑vue

    <template> <div> <div class="demo-type" align="right" style=" ...

  2. word2vec原理与代码

    目录 前言 CBOW模型与Skip-gram模型 基于Hierarchical Softmax框架的CBOW模型 基于Negative Sampling框架的CBOW模型 负采样算法 结巴分词 wor ...

  3. Could not attach to a Hearthstone process.

    配置的加载 // Hearthbuddy.Windows.ConfigurationWindow // Token: 0x060001DB RID: 475 RVA: 0x00088A3C File ...

  4. koa 项目实战(十一)验证登录和注册的 input

    1.验证注册参数 根目录/validation/register.js const Validator = require('validator'); const isEmpty = require( ...

  5. ansible的错误

    错误 [root@bogon ansible]# ansible test -m ping 192.168.16.155 | FAILED! => { "msg": &quo ...

  6. git 命令简洁手册

    1.从当前目录初始化 git init 2.对文件进行跟踪 或  将已跟踪的文件放到暂缓区 或 把有冲突的文件标记为已解决状态 git add <file> 3.从现有仓库克隆 git c ...

  7. Android四层体系架构

    Application应用层 应用是用Java语言编写的运行在虚拟机上的程序,即图中最上层的蓝色部分.手机的上层应用其实,Google最开始时就在Android系统中捆绑了一些核心应用比如e-mail ...

  8. Ubuntu14.04+安卓系统4.3+JDK6编译源码

    本博客主要参照: https://www.jianshu.com/p/ecb9c132030f https://blog.csdn.net/gobitan/article/details/243674 ...

  9. [GPU] Install H2O.ai

    一.前言 主页:https://www.h2o.ai/products/h2o4gpu/ GPU版本安装:h2oai/h2o4gpu 采用GPU,能否成为超越下面链接中实验的存在? [ML] LIBS ...

  10. 监控数据库DDL操作日志

    背景 为了监控好生产环境下各个数据库服务器上DDL操作日志,便于运维工程师管控好风险,我们有必要关注当前实例下的所有的DDL操作以及对应的IP和hostname. 测试环境 Microsoft SQL ...