{"id":138319,"date":"2019-03-08T10:30:07","date_gmt":"2019-03-08T02:30:07","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=138319"},"modified":"2019-02-27T09:31:02","modified_gmt":"2019-02-27T01:31:02","slug":"mac-set-docker","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/mac-set-docker.html","title":{"rendered":"\u5728mac\u4e0a\u5b89\u88c5 docker"},"content":{"rendered":"

docker\u6781\u5927\u63d0\u9ad8\u4e86\u5e94\u7528\u7684\u8fd0\u884c\u6548\u7387\uff0c\u964d\u4f4e\u4e86\u4e91\u8ba1\u7b97\u8d44\u6e90\u4f9b\u5e94\u7684\u6210\u672c\uff0c\u540c\u65f6\u8ba9\u5e94\u7528\u7684\u90e8\u7f72\u3001\u6d4b\u8bd5\u548c\u5206\u53d1\u90fd\u53d8\u5f97\u524d\u6240\u672a\u6709\u7684\u9ad8\u6548\u548c\u8f7b\u677e\uff01docker\u662f\u4e00\u4e2a\u5bb9\u5668\uff0c\u4e0d\u50cfkvm\uff0c\u4ed6\u662f\u771f\u5b9e\u7684\u7cfb\u7edf\uff0c\u542f\u52a8\u65f6\uff0cKVM\u6d88\u8017\u7684\u8d44\u6e90\u66f4\u591a\u3002<\/p>\n

1,\u5b89\u88c5docker toolbox\uff0cvirtualbox<\/strong><\/div>\n
#\u00a0brew\u00a0cask\u00a0install\u00a0virtualbox\r\n#\u00a0brew\u00a0cask\u00a0install\u00a0docker-toolbox<\/pre>\n
2,\u6ce8\u518c\u963f\u91ccdocker\u52a0\u901f\u5668,\u63d0\u4f9b\u4e00\u4e2a\u52a0\u901f\u5730\u5740<\/strong><\/div>\n

https:\/\/dev.aliyun.com\/<\/span><\/p>\n

\u8fd9\u4e00\u6b65\u4e0d\u662f\u5fc5\u987b\uff0c\u4f46\u662f\u4e2a\u4eba\u89c9\u5f97\u8fd8\u662f\u6709\u5fc5\u8981\u505a\u4e00\u4e0b\u3002\u670d\u52a1\u5668\u5728\u56fd\u5916\uff0c\u4f60\u61c2\u7684\u3002<\/p>\n

3,\u521b\u5efa\u4e00\u4e2aimage<\/strong><\/div>\n
docker-machine\u00a0create\u00a0--engine-registry-mirror=https:\/\/aurtqjzl.mirror.aliyuncs.com\u00a0-d\u00a0virtualbox\u00a0default<\/pre>\n

\u8be5\u547d\u4ee4\u8fd8\u4f1a\u5728 ~\/.docker\/machine\/machines\/default \u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a docker machine \u7684\u914d\u7f6e\u6587\u4ef6\u3002\u60a8\u53ea\u9700\u6267\u884c\u4e00\u6b21 create \u547d\u4ee4\u3002\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 docker-machine \u547d\u4ee4\u6765\u5f00\u542f\uff0c\u505c\u6b62\uff0c\u67e5\u8be2\u5e76\u7ba1\u7406\u865a\u62df\u673a\u3002<\/p>\n

\u5982\u679c\u521b\u5efa\u65f6\u6ca1\u6709\u6dfb\u52a0\uff0c\u52a0\u901f\u5668\u3002\u53ef\u4ee5\u8fdb\u884c\u4ee5\u4e0b\u64cd\u4f5c<\/p>\n

\u00a0$\u00a0docker-machine\u00a0ssh\u00a0default\u00a0\/\/ssh\u5230default\r\n$\u00a0cat\u00a0\/var\/lib\/boot2docker\/profile\r\nEXTRA_ARGS='\r\n--label\u00a0provider=virtualbox\r\n--registry-mirror\u00a0https:\/\/aurtqjzl.mirror.aliyuncs.com\u00a0\/\/\u6dfb\u52a0'\r\nCACERT=\/var\/lib\/boot2docker\/ca.pem\r\nDOCKER_HOST='-H\u00a0tcp:\/\/0.0.0.0:2376'\r\nDOCKER_STORAGE=aufs\r\nDOCKER_TLS=auto\r\nSERVERKEY=\/var\/lib\/boot2docker\/server-key.pem\r\nSERVERCERT=\/var\/lib\/boot2docker\/server.pem<\/pre>\n
4\uff0c\u83b7\u53d6 default\u7684\u73af\u5883\u53d8\u91cf<\/strong><\/div>\n
$\u00a0docker-machine\u00a0env\u00a0default\u00a0\/\/default\u5c31\u662f\u4e0a\u9762\u521b\u5efa\u7684\u540d\u79f0\r\nexport\u00a0DOCKER_TLS_VERIFY=\"1\"\r\nexport\u00a0DOCKER_HOST=\"tcp:\/\/192.168.99.100:2376\"\r\nexport\u00a0DOCKER_CERT_PATH=\"\/Users\/zhangying\/.docker\/machine\/machines\/default\"\r\nexport\u00a0DOCKER_MACHINE_NAME=\"default\"\r\n#\u00a0Run\u00a0this\u00a0command\u00a0to\u00a0configure\u00a0your\u00a0shell:\r\n#\u00a0eval\u00a0\"$(docker-machine\u00a0env\u00a0default)\"<\/pre>\n
5\uff0c\u6fc0\u6d3b default\u00a0<\/strong><\/div>\n
\u00a0#\u00a0eval\u00a0\"$(docker-machine\u00a0env\u00a0default)\"\r\nzhangyingdeMacBook-Pro:machines\u00a0zhangying$\u00a0docker-machine\u00a0ls\r\nNAME\u00a0ACTIVE\u00a0DRIVER\u00a0STATE\u00a0URL\u00a0SWARM\u00a0DOCKER\u00a0ERRORS\r\ndefault\u00a0*\u00a0virtualbox\u00a0Running\u00a0tcp:\/\/192.168.99.100:2376\u00a0v17.05.0-ce\r\nmytest\u00a0-\u00a0virtualbox\u00a0Stopped\u00a0Unknown<\/pre>\n

\u5e26*\u53f7\u8868\u793a\u662f\u6fc0\u6d3b<\/p>\n

6,\u542f\u52a8centos<\/strong><\/div>\n
$\u00a0docker\u00a0run\u00a0-it\u00a0centos<\/pre>\n

\u4f1a\u63d0\u793a\u4f60\u6ca1\u6709centos\uff0c\u7136\u540e\u5c31\u4f1a\u53bb\u4e0b\u8f7d\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

docker\u6781\u5927\u63d0\u9ad8\u4e86\u5e94\u7528\u7684\u8fd0\u884c\u6548\u7387\uff0c\u964d\u4f4e\u4e86\u4e91\u8ba1\u7b97\u8d44\u6e90\u4f9b\u5e94\u7684\u6210\u672c\uff0c\u540c\u65f6\u8ba9\u5e94\u7528\u7684\u90e8\u7f72\u3001\u6d4b\u8bd5\u548c\u5206\u53d1\u90fd\u53d8\u5f97\u524d\u6240\u672a\u6709\u7684 […]<\/p>\n","protected":false},"author":63,"featured_media":138380,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-138319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/138319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=138319"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/138319\/revisions"}],"predecessor-version":[{"id":138472,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/138319\/revisions\/138472"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/138380"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=138319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=138319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=138319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}