一、docker架构

  

  无论是C端还是S端都由docker一个程序提供,这个程序有很多子程序,其中有一个子程序的子命令叫daemon,表示运行为守护进程,因此我们运行docker daemon就表示把这台主机变为守护进程服务器,它可以监听在所谓的套接字之上,为了安全起见默认只提供本机的unix socket 文件套接字,

  1、client端

  2、server端,docker daemo守护进程,监听在套接字之上。docker支持三种类型套接字。

    a、ip v4套接字:即IPv4 + 端口套接字

    b、ip v6套接字 :即IPv6 + 端口套接字

    c、unix socket file :监听在本地的文件上,此种方式只允许客户端为本地。

  3、docker 版本

    docker ee :docker 企业版

    docker ce :docker 社区版

二、docker 镜像仓库

  1、作用

    a、提供镜像存储的仓库

    b、提供用户获取镜像时的认证

    c、提供当前服务器上所有可用镜像的索引

  2、一个镜像仓库一般只用做一种应用

三、Docker 安装和使用

  1、不建议centos yum源里面的docker源

  2、docker 稳定版清华源

    https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/7/x86_64/stable/repodata/

  3、安装步骤

    a、首先下载清华源docker repo文件:

[root@localhost yum.repos.d]# wget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
---- ::-- https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, :f000:::::
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:... connected.
HTTP request sent, awaiting response... OK
Length: (.4K) [application/octet-stream]
Saving to: ‘docker-ce.repo’ %[==================================================================================================================================>] , --.-K/s in 0s -- :: ( MB/s) - ‘docker-ce.repo’ saved [/]

    b、修改文件中链接为清华源仓库

[root@localhost yum.repos.d]# sed -i 's@https://download.docker.com@https://mirrors.tuna.tsinghua.edu.cn/docker-ce@g' docker-ce.repo
[root@localhost yum.repos.d]# more docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/7/$basearch/stable
enabled=
gpgcheck=
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/gpg [docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/7/debug-$basearch/stable
enabled=
gpgcheck=
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/gpg
...

    c、yum install -y docker-ce即可完成安装

    d、制作镜像加速

      增加docker配置文件并且配置加速链接。(列表中配置了cn加速连接,还可以配置阿里云加速等连接)

[root@localhost docker]# cat >> /etc/docker/daemon.json <<EOF
> {
> "registry-mirrors": ["https://guxaj7v7.mirror.aliyuncs.com","https://registry.docker-cn.com"]
> }
> EOF

    e、启动docker 即可

[root@localhost log]# systemctl start docker
[root@localhost log]# docker version
Client:
Version: 18.09.
API version: 1.39
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false Server: Docker Engine - Community
Engine:
Version: 18.09.
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: 774a1f4
Built: Thu Feb ::
OS/Arch: linux/amd64
Experimental: false

    f、要查看更详细的环境信息使用docker info即可

[root@localhost log]# docker info
Containers:
Running:
Paused:
Stopped:
Images:
Server Version: 18.09.
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e6b3f5632f50dbc4e9cb6288d911bf4f5e95b18e
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.-.el7.x86_64
Operating System: CentOS Linux (Core)
OSType: linux
Architecture: x86_64
CPUs:
Total Memory: .781GiB
Name: localhost.localdomain
ID: Z7YJ:IMB4:5GCY:LZRC:33ER:7Y4A:VYN5:RZUK:VGRG:JULJ:Y5CM:HOLP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/
Registry Mirrors:
https://registry.docker-cn.com/
Live Restore Enabled: false
Product License: Community Engine WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

四、docker 常用操作

  1、查找镜像:docker search,搜索docker 镜像 (没有 / 的为顶级仓库一般为docker官方的,有 / 的为用户仓库)

[root@localhost log]# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… [OK]
jrcs/letsencrypt-nginx-proxy-companion LetsEncrypt container to use with nginx as p… [OK]
webdevops/php-nginx Nginx with PHP-FPM [OK]
kitematic/hello-world-nginx A light-weight nginx container that demonstr…
zabbix/zabbix-web-nginx-mysql Zabbix frontend based on Nginx web-server wi… [OK]
bitnami/nginx Bitnami nginx Docker Image [OK]
linuxserver/nginx An Nginx container, brought to you by LinuxS…
1and1internet/ubuntu--nginx-php-phpmyadmin-mysql- ubuntu--nginx-php-phpmyadmin-mysql- [OK]
tobi312/rpi-nginx NGINX on Raspberry Pi / armhf [OK]
nginx/nginx-ingress NGINX Ingress Controller for Kubernetes
nginxdemos/hello NGINX webserver that serves a simple page co… [OK]
wodby/drupal-nginx Nginx for Drupal container image [OK]
blacklabelops/nginx Dockerized Nginx Reverse Proxy Server. [OK]
schmunk42/nginx-redirect A very simple container to redirect HTTP tra… [OK]
centos/nginx--centos7 Platform for running nginx 1.8 or building n…
centos/nginx--centos7 Platform for running nginx 1.12 or building …
nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles
1science/nginx Nginx Docker images that include Consul Temp… [OK]
mailu/nginx Mailu nginx frontend [OK]
travix/nginx NGinx reverse proxy [OK]
toccoag/openshift-nginx Nginx reverse proxy for Nice running on same… [OK]
ansibleplaybookbundle/nginx-apb An APB to deploy NGINX [OK]
wodby/nginx

  2、查看镜像docker images,docker镜像有最基础的alpine版本。并且busybox是一个很有意思的程序,它被链接成什么命令就可以被当做什么命令使用。

    

  3、显示完整的镜像信息 docker images --no-trunc

[root@localhost log]# docker images --no-trunc
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest sha256:d8233ab899d419c58cf3634c0df54ff5d8acc28f8173f09c21df4a07229e1205 weeks ago .2MB
nginx 1.14-alpine sha256:66952fd0a8efa0598626fad89d3a0827bc24fc92c3adb576adbc9fd58606e1af weeks ago 16MB
centos sha256:721823ac0277f52bcfd4933832d47ef0d5612191e92aef558291d5b3c15ceb35 months ago 284MB

  

    

Docker 学习2 Docker基础用法的更多相关文章

  1. Docker学习笔记 — Docker私有仓库搭建

    Docker学习笔记 — Docker私有仓库搭建   目录(?)[-] 环境准备 搭建私有仓库 测试 管理仓库中的镜像 查询 删除 Registry V2   和Mavan的管理一样,Dockers ...

  2. Docker学习之Docker容器基本使用

    Docker学习之Docker容器基本使用 新建容器并启动 命令格式:docker run --options repository:tag 后台运行 命令格式:-d 已存在的容器相关操作 启动:do ...

  3. Docker学习之Docker镜像基本使用

    Docker学习之Docker镜像基本使用 获取镜像 命令格式:docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] 例如: docker pull ...

  4. Docker:学习笔记(1)——基础概念

    Docker:学习笔记(1)——基础概念 Docker是什么 软件开发后,我们需要在测试电脑.客户电脑.服务器安装运行,用户计算机的环境各不相同,所以需要进行各自的环境配置,耗时耗力.为了解决这个问题 ...

  5. docker学习笔记--重基础使用

    最近一直在研究Elasticsearch,后来部门的同事遇到了一个docker集群的未授权访问漏洞,于是稍微看了一下docker进行了一下基本的入门,本文把自己学习docker的过程进行了一个详细的记 ...

  6. Docker学习笔记:基础

    docker的概念 :docker是一个可供开发者在容器中 开发 部署 运行 应用的一个平台.通过使用Linux容器去部署应用的方式称为容器化. 基础概念 Images and Container i ...

  7. Docker学习之1—基础及安装

    Docker介绍: Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制 ...

  8. Docker学习笔记 — Docker私有仓库搭建【转载】

    标签: Docker 2015-03-10 21:08 24190人阅读 评论(0) 收藏 举报  分类: Docker(26)    目录(?)[+]   和Mavan的管理一样,Dockers不仅 ...

  9. Docker学习笔记 - Docker容器内部署redis

    Docker学习笔记(2-4)Docker应用实验-redist server 和client的安装使用 一.获取redis容器(含客户端和服务端) 二.创建服务端容器 1.在终端A中运行redis- ...

随机推荐

  1. python实现查找文件

    import os.pathwhile True: rootdir=input('请输入遍历文件夹的绝对路径:(q退出)') if rootdir=='q': break if not(os.path ...

  2. GWAS:拒绝假阳性之case和control数量比例严重失衡的解决方案(SAIGE模型的应用)

    一.为什么要校正case和control数量比例不平衡情况 试问作为生信届人员,最怕的是什么,当然是统计结果不靠谱.统计结果不靠谱包括两方面:一个是假阴性,一个是假阳性.假阴性可以理解为白天鹅被误当成 ...

  3. Redisson分布式锁实现

    转: Redisson分布式锁实现 2018年09月07日 15:30:32 校长我错了 阅读数:3303   转:分布式锁和Redisson实现 概述 分布式系统有一个著名的理论CAP,指在一个分布 ...

  4. codeforces-1131 (div2)

    A.把右上角的凹缺口补上变成凸的就成了规则矩形 #include <map> #include <set> #include <ctime> #include &l ...

  5. linux通过expect工具来实现自动登录服务器,并执行相关操作

    参考地址:https://www.cnblogs.com/liyuanhong/articles/7728034.html EOF的使用参考:https://www.cnblogs.com/liyua ...

  6. 002 网上看的unity学习路线

  7. nodeJS模块寻址规则

    引子 阮一峰一则教程中, 将应用放置在  npm 模块安装目录同等级的目录(https://github.com/ruanyf/webpack-demos)下. 但是应用目录文件中, 引用标准库的使用 ...

  8. phpinfo

    phpinfo是一个运行指令,为显示php服务器的配置信息.    phpinfo函数是PHP最为常用的配置输出函数.phpinfo函数能够输出服务器PHP当前状态的大量信息,其中包含了PHP的编译选 ...

  9. HTML和XHTML区别

    HTML和XHTML 可扩展超文本标记语言XHTML(eXtensible HyperText Markup Language)是将超文本标记语言HTML(HyperText Markup Langu ...

  10. P5284 [十二省联考2019]字符串问题

    这是一道涵盖了字符串.图论.数据结构三个方面的综合大题. 把这道题放在D1T2的人应该拖出去打 前置芝士 首先,您至少要会topsort. 其次,如果您只想拿个暴力分,字符串Hash就足够了:如果您想 ...