存储架构

Docker Remote API 开发(一)

基本常见的Docker Control Panel 都是收费的,所以手贱打算自己弄一个玩,技术栈:

预期效果图:

因为我机器是使用Docker Machine创建,所以默认已经从Unix socket转发到了tcp port,如果是自己配置,需要在node节点上修改配置文件:

root@node-1:~# cat /etc/default/docker

DOCKER_OPTS='
-H tcp://0.0.0.0:2376
-H unix:///var/run/docker.sock
--storage-driver aufs
--tlsverify
--tlscacert /etc/docker/ca.pem
--tlscert /etc/docker/server.pem
--tlskey /etc/docker/server-key.pem
--label provider=aliyunecs

'

这里注意一下-H 就是转发的配置了,另外还有tls的验证选项,详细配置请看文档:

使用Docker Remote API v1.24,调用远程接口测试:

curl -v -k -E https://{SERVER_IP}:2376/images/json 
  --cert ~/.docker/machine/machines/hz-1/cert.pem 
  --key ~/.docker/machine/machines/hz-1/key.pem 
  --cacert ~/.docker/machine/machines/hz-1/ca.pem

可以拿到数据:

[
    {
        "Id":"sha256:6ff756f6fc44903216bf36e941db37ed5bb707c533c9c07e513d02fc7dfad4ad",
        "ParentId":"",
        "RepoTags":[
            "redis:3.2.3-alpine"
        ],
        "RepoDigests":[
            "redis@sha256:fe846dd3decd53475c7f6b007ccf10834bdd60d3a649ebdb69f43aa10393e80f"
        ],
        "Created":1474338745,
        "Size":20379436,
        "VirtualSize":20379436,
        "Labels":{

        }
    }
]

待续。

———分割线———

curl问题:

OS X: Using PEM private keys fail with error: OSStatus -25299

找到解决方法:

For anyone else getting to this issue when searching for "OSStatus -25299", this is how to convert a pem + cert to pkcs12..

openssl pkcs12 -export -in ./client.crt -inkey ./client.pem -out client.p12

where client.crt is your cert, client.pem is your private key, and client.p12 is your new password encrypted cert/key pkcs12 container.

With that I was able to use curl correctly with something like:
curl -v -k -E ./client.p12:password http://url

更简单的:

or just install curl with openssl support:

$ brew install curl --with-openssl
$ brew link curl --force
$ brew --version
curl 7.50.1 (x86_64-apple-darwin15.6.0) libcurl/7.50.1 OpenSSL/1.0.2h zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
(Note: You will probably need to run brew uninstall curl if you have another version of cURL installed using Brew.)

原贴地址:

OS X: Using PEM private keys fail with error: OSStatus -25299 · Issue #283 · curl/curl · GitHub

阅读原文...

苏依蜀黍de小木屋

如何让扁平化设计更出彩?

上一篇

罗永浩的锤子SMARTISAN M1 PPT模板源文件下载[PPTX]

下一篇

你也可能喜欢

评论已经被关闭。

插入图片
Docker Remote API 开发(一)

长按储存图像,分享给朋友