Ubuntu Docker的CS模式怎么实现

60次阅读
没有评论

共计 2056 个字符,预计需要花费 6 分钟才能阅读完成。

本篇内容介绍了“Ubuntu Docker 的 CS 模式怎么实现”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让丸趣 TV 小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

ubuntu16.04docker 的 cs 模式

remote api

docker 除了使用命令让用户通过客户端与 docker 的守护进行通信, 也提供了 remote api 方式的通信接口

restful 风格 api

stdin,stdout,stderr

连接方式

使用 socket 方式进行连接, 有下列三种方式

unix:///var/run/docker.sock
tcp://host:port
fd://socketfd

eggyer@ubuntu:/usr/local/dockerfile/df_test1$ docker version
client:
 version: 1.9.1
 api version: 1.21
 go version: go1.4.3
 git commit: a34a1d5
 built: fri nov 20 17:56:04 utc 2015
 os/arch: linux/amd64
server:
 version: 1.9.1
 api version: 1.21
 go version: go1.4.3
 git commit: a34a1d5
 built: fri nov 20 17:56:04 utc 2015
 os/arch: linux/amd64

如上所示可以看到 server 中 apiversion(remote api 的版本)

通过 unix:///var/run/docker.sock 访问

注意发送 http 请求时输入完 get 信息后要连按两次回车

eggyer@ubuntu:/usr/local/dockerfile/df_test1$ nc -u /var/run/docker.sock
get /info http/1.1
http/1.1 200 ok
content-type: application/json
server: docker/1.9.1 (linux)
date: sat, 26 nov 2016 14:33:45 gmt
content-length: 1162
{id : wbmi:td6b:prun:xwsx:5rvv:quyo:5s27:w74l:mq3w:ydb7:jxpl:nr5x , containers :12, images :11, driver : aufs , driverstatus :[[ root dir , /var/lib/docker/aufs],[backing filesystem , extfs],[dirs , 35],[dirperm1 supported , true]], memorylimit :true, swaplimit :false, cpucfsperiod :true, cpucfsquota :true, ipv4forwarding :true, bridgenfiptables :true, bridgenfip6tables :true, debug :false, nfd :19, oomkilldisable :true, ngoroutines :33, systemtime : 2016-11-26t22:33:45.641108177+08:00 , executiondriver : native-0.2 , loggingdriver : json-file , neventslistener :0, kernelversion : 4.4.0-47-generic , operatingsystem : ubuntu 16.04.1 lts (containerized) , indexserveraddress : https://index.docker.io/v1/ , registryconfig :{insecureregistrycidrs :[ 127.0.0.0/8], indexconfigs :{docker.io :{ name : docker.io , mirrors :null, secure :true, official :true}}, mirrors :null}, initsha1 : , initpath : /usr/bin/docker , ncpu :4, memtotal :4125528064, dockerrootdir : /var/lib/docker , httpproxy : , httpsproxy : , noproxy : , name : ubuntu , labels :null, experimentalbuild :false, serverversion : 1.9.1 , clusterstore : , clusteradvertise : }

“Ubuntu Docker 的 CS 模式怎么实现”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注丸趣 TV 网站,丸趣 TV 小编将为大家输出更多高质量的实用文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-15发表,共计2056字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)