Docker 学习2 Docker基础用法
一、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基础用法的更多相关文章
- Docker学习笔记 — Docker私有仓库搭建
Docker学习笔记 — Docker私有仓库搭建 目录(?)[-] 环境准备 搭建私有仓库 测试 管理仓库中的镜像 查询 删除 Registry V2 和Mavan的管理一样,Dockers ...
- Docker学习之Docker容器基本使用
Docker学习之Docker容器基本使用 新建容器并启动 命令格式:docker run --options repository:tag 后台运行 命令格式:-d 已存在的容器相关操作 启动:do ...
- Docker学习之Docker镜像基本使用
Docker学习之Docker镜像基本使用 获取镜像 命令格式:docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] 例如: docker pull ...
- Docker:学习笔记(1)——基础概念
Docker:学习笔记(1)——基础概念 Docker是什么 软件开发后,我们需要在测试电脑.客户电脑.服务器安装运行,用户计算机的环境各不相同,所以需要进行各自的环境配置,耗时耗力.为了解决这个问题 ...
- docker学习笔记--重基础使用
最近一直在研究Elasticsearch,后来部门的同事遇到了一个docker集群的未授权访问漏洞,于是稍微看了一下docker进行了一下基本的入门,本文把自己学习docker的过程进行了一个详细的记 ...
- Docker学习笔记:基础
docker的概念 :docker是一个可供开发者在容器中 开发 部署 运行 应用的一个平台.通过使用Linux容器去部署应用的方式称为容器化. 基础概念 Images and Container i ...
- Docker学习之1—基础及安装
Docker介绍: Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制 ...
- Docker学习笔记 — Docker私有仓库搭建【转载】
标签: Docker 2015-03-10 21:08 24190人阅读 评论(0) 收藏 举报 分类: Docker(26) 目录(?)[+] 和Mavan的管理一样,Dockers不仅 ...
- Docker学习笔记 - Docker容器内部署redis
Docker学习笔记(2-4)Docker应用实验-redist server 和client的安装使用 一.获取redis容器(含客户端和服务端) 二.创建服务端容器 1.在终端A中运行redis- ...
随机推荐
- linux下python安装
下载包: wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.gz 解压安装: tar -zvxf Python-3.6.3. ...
- 老男孩Python全栈学习 S9 日常作业 008
1.有如下两个集合,pythons是报名python课程的学员名字集合,linuxs是报名linux课程的学员名字集合 pythons={'alex','egon','yuanhao','wupeiq ...
- hive 时间函数
使用时发现:1.datediff可以传入timestamp类型参数 官网文档: Date Functions The following built-in date functions are ...
- javascript 获取字符递增
比如A->B,AA->AB,Z->AA 参考https://blog.csdn.net/xiaotao2004/article/details/75096607 C#版本,改写为ja ...
- 试用VS2019正式版
1.下载地址https://visualstudio.microsoft.com/zh-hans/downloads/2.安装,安装过程比较简单,直接下一步,下一步即可,现在的网速一般下载+安装要2个 ...
- python 使用win32com实现对word文档批量替换页眉页脚
最近由于工作需要,需要将70个word文件的页眉页脚全部进行修改,在想到这个无聊/重复/没有任何技术含量的工作时,我的内心是相当奔溃的.就在我接近奔溃的时候我突然想到完全可以用python脚本来实现这 ...
- 视频显著性检测-----Predicting Video Saliency using Object-to-Motion CNN and Two-layer Convolutional LSTM
帧内显著性检测: 将卷积网络的多层特征进行组合通过unsampling 得到粗显著性预测: 帧间显著性检测: (粗检测结果+新卷积网络的特征图,最后+之前卷积网络的卷积特征输入到LSTM中)进行预测. ...
- RLException: XXX is neither a launch file in package XXX nor is XXX a launch file name问题解决
在运行roslaunch时出现了类似下面的错误: RLException: XXX is neither a launch file in package XXX nor is XXX a launc ...
- VIM编辑器使用
- h5页面使用js实现保存当前图片到手机相册
很可惜,这个鬼东西微信内置浏览器不适用 页面: <!doctype html> <html> <head> <meta charset="UTF-8 ...