https://docs.docker.com/install/linux/linux-postinstall/#next-steps
https://docs.docker.com/engine/api/v1.37/#
https://docs.docker.com/engine/security/https/
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
HTTP配置文件
[Service]
ExecStart=
#HTTP使用以下命令
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
HTTPS配置文件
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
ExecStart=
#HTTP使用以下命令
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
sudo systemctl daemon-reload
sudo systemctl restart docker.service
sudo netstat -lntp | grep dockerd
打开浏览器访问:http://宿主机IP:2375/info
确认是否和docker部署机docker info返回值一致
测试其他接口是否正常:http://宿主机IP:2375/networks
对应命令参考:docker network ls
备注:更多命令请参考官方文档https://docs.docker.com/engine/api/v1.37/
$ openssl genrsa -aes256 -out ca-key.pem 4096
Generating RSA private key, 4096 bit long modulus
....................................................................++
........++
e is 65537 (0x10001)
Enter pass phrase for ca-key.pem:(输入自己要设置的密码,并记住该密码,下面要用)
Verifying - Enter pass phrase for ca-key.pem:(确认设置的密码)
$ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem
Enter pass phrase for ca-key.pem:(输入上一步设置的密码)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN(输入国家的名字)
State or Province Name (full name) [Some-State]:shandong(输入省份的名字)
Locality Name (eg, city) []:jinan(输入城市的名字)
Organization Name (eg, company) [Internet Widgits Pty Ltd]:cnHuaShao(输入机构、公司的名字,不输入直接回车)
Organizational Unit Name (eg, section) []:cnHuaShao(输入单位、部门名字,不输入直接回车)
Common Name (e.g. server FQDN or YOUR name) []:zhangyc(输入主机名,这里输入的是$HOST,需要保证其HOSTS文件中已经配置了该名称)
Email Address []:lz2392504@gmail.com(输入邮箱地址)
$ openssl genrsa -out server-key.pem 4096
Generating RSA private key, 4096 bit long modulus
.....................................................................++
.................................................................................................++
e is 65537 (0x10001)
$ openssl req -subj "/CN=zhangyc" -sha256 -new -key server-key.pem -out server.csr
$ echo subjectAltName = DNS:zhangyc,IP:192.168.10.10,IP:127.0.0.1 >> extfile.cnf
$ echo extendedKeyUsage = serverAuth >> extfile.cnf
$ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem \
-CAcreateserial -out server-cert.pem -extfile extfile.cnf
Signature ok
subject=/CN=zhangyc(输入host名)
Getting CA Private Key
Enter pass phrase for ca-key.pem:(输入第一步时设置的密码)
未完待续
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。