docker与虚拟机相比,没有虚拟化内核,转而使用宿主机的内核。因此docker更轻更快



docker缺点:后端兼容性测试需求。把软件安装在不同的操作系统上进行测试,观察软件运行是否良好。

不能用docker做兼容性测试

uname -a 查看系统内核版本

docker关键技术:

  • Namespace:通过名称控件达到了网络隔离
  • 联合文件系统:通过联合文件系统达到了文件目录的隔离
  • Cgroups:阻止容器中的软件和进程无限制的使用宿主机中的资源达到了资源隔离,如CPU和内存。

    组织容器除了内核共享,其他的都不是共享的

docker测试应用:

  • 搭建测试环境
  • 搭建各类基础服务
  • 搭建测试执行环境

选择docker的原因:

  • docker相对虚拟机轻量级,更轻更快
  • docker使用简单
  • docker共享,有大量的镜像可以使用

查看docker命令

Usage:	docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default "/Users/chenshanju/.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/Users/chenshanju/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/Users/chenshanju/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/Users/chenshanju/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit Management Commands:
builder Manage builds
checkpoint Manage checkpoints
config Manage Docker configs
container Manage containers
engine Manage the docker engine
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes Commands:
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
deploy Deploy a new stack or update an existing stack
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes Run 'docker COMMAND --help' for more information on a command.

查看docker信息

docker版本号:从17年开始,以年-月命名版本号

Containers: 3    #当前的容器
Running: 1 #运行中的容器
Paused: 0
Stopped: 2 #已停止的容器
Images: 13 #镜像数量
Server Version: 18.09.0-ce-beta1 #docker版本
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan 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: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.855GiB
Name: linuxkit-025000000001
ID: IY7T:MW22:QBUX:KOJW:SOBV:TJUK:VXQA:HWGF:ZWXD:TAJP:KGPP:AKQ5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 32
Goroutines: 57
System Time: 2018-11-02T08:12:50.1509806Z
EventsListeners: 2
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://i2piuqyy.mirror.aliyuncs.com/
Live Restore Enabled: false
Product License: Community Engine

docker官方下载地址:https://hub.docker.com

注意:不用登陆,直接搜索镜像即可。一般选择官方镜像,如Jenkins,选择official

联合文件系统





如下载Jenkins时,有20层,Jenkins是一个经过20层文件修改生成的镜像



优点:节省硬盘空间

FAQ:

1.docker安装后,命令行使用docker,提示命令不可用,如下图所示


原因:/usr/local/bin未生效,将/usr/local/bin添加到环境变量即可

export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"

2.centOS安装docker,提示Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

解决方法:

systemctl daemon-reload
sudo service docker restart
sudo service docker status
#再次执行ps,不会再报错
docker ps

sudo service docker status

1021 docker初识的更多相关文章

  1. Docker初识

    <Docker--从入门到实践>是Docker技术的入门教程,学习时长两天,现整理关键点如下: 1. 什么是Docker? 轻量级操作系统虚拟化解决方案:Go语言实现:下图很好地说明了Do ...

  2. docker --- 初识

    Docker简介 Docker是一个开源的引擎,可以轻松的为任何应用创建一个轻量级的.可移植的.自给自足的容器.开发者在笔记本上编译测试通过的容器可以批量地在生产环境中部署,包括VMs(虚拟机).ba ...

  3. docker 初识之二(简单发布ASP.NET Core 网站)

    在发布ASP.NET Core网站以前,先介绍一下DaoCloud 一个免费的docker云容器服务平台.登陆官方网站,创建一台docker主机,这台主机有120分钟的使用时间,对于鄙人学习使用正好合 ...

  4. 1021 docker prometheus监控体系

    jmeter plugin监控的信息很少,只有cpu.内存.网络IO,但这些是不够的.例如对于分析mysql数据库的慢查询.最大连接数等更加细密度的信息. 服务端稳定测试的三个前提: 1.应用级别的自 ...

  5. 1021 docker搭建mysql、网络模式、grid

    1.搭建并连接mysql服务 1.1.mysql官方命令 https://hub.docker.com/_/mysql/ #下载mysql镜像: docker pull mysql #启动mysql: ...

  6. 1021 docker常用命令和Jenkins搭建

    docker常用命令 1.镜像管理 docker pull (镜像名) # 默认拉取最新版本的镜像 docker pull (镜像名:版本号) #拉取指定版本的镜像 docker push (镜像名) ...

  7. Docker初识笔记

    Docker docker说白了就是:环境打包 我们能用docker什么? 1.如果配置好本地的linux环境交接给其他人,很麻烦,交接时要告诉他,装这个装那个,还可能出现问题,那我直接把这个环境放到 ...

  8. Docker 初识之路

    一. 安装配置 1.安装依赖 sudo yum install -y yum-utils device-mapper-persistent-data lvm2   2.设置阿里云镜像源 sudo yu ...

  9. Docker学习のDocker初识

    一.Docker是什么 Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源. Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然 ...

随机推荐

  1. [SpringBoot] - 了解什么是SpringBoot,使用SpringBoot的配置文件

    首先明白Spring是什么,Spring是Java开发的一个框架,为了方便简化Java开发. 什么是注解(注解式开发)? Spring的常用注解有哪些? 假如用SpringBoot构建一个网站程序,应 ...

  2. 癌症免疫细胞治疗知识:CAR-T与TCR-T的区别在哪里?--转载

    肿瘤免疫治疗,实际上分为两大类.一种把肿瘤的特征“告诉”免疫细胞,让它们去定位,并造成杀伤:另一种是解除肿瘤对免疫的耐受/屏蔽作用,让免疫细胞重新认识肿瘤细胞,对肿瘤产生攻击(一般来说,肿瘤细胞会巧妙 ...

  3. TCGA下载神器--TCGAbiolinks

    http://bioconductor.org/packages/devel/bioc/vignettes/TCGAbiolinks/inst/doc/tcgaBiolinks.html#gdcque ...

  4. python 计算阶乘

    # 用for循环计算 n! sum = n=int(input('请输入n=')) ,n+): ,-): sum *= j # sum=sum*j print('%d!=%3d' %(i,sum)) ...

  5. Hive 建外链表到 Hbase(分内部表、外部表两种方式)

    一. Hive 建内部表,链到hbase :特点:Hive drop表后,Hbase 表同步删除 drop table if exists hbase_kimbo_test1;CREATE TABLE ...

  6. POJ 2823 单调队列入门水题

    最最基础的单调队列题目.一个单增一个单减.还是可以借此好好理解一下单调队列的. #include <stdio.h> #include <string.h> #include ...

  7. POJ 1961 循环节

    和POJ 2406 几乎一样.前者是求 该字符串的最小的循环节.也就是最大的循环次数.后者是求该字符串的每个前缀的循环节的最大循环次数.(如果有的话).而且必须大于1.才可以输出.就是POJ 2406 ...

  8. 转载 ORACLE中实现表变量的方法

    源文地址:http://blog.itpub.net/750077/viewspace-2134222/ 经常看到SQLSERVER 中用表变量类型的方式就能做到缓存一个比较大的中间结果, 然后再对这 ...

  9. epoint:TreeView

    Epoint.Web.UI.WebControls2X.EpointTreeNode 思路:就是使用递归 RootNodeText 根节点名称RootNodeUrl 根节点路径ShowRootNode ...

  10. linux下部署tomcat服务器之安装tomcat

    下载tomcat压缩包 apache-tomcat-7.0.82.tar.gz 在把包放到linux 的softwore文件夹下  自己选择文件夹 tar -zxvf apache-tomcat-7. ...