{"rsdb":{"rid":"241164","subhead":"","postdate":"0","aid":"166083","fid":"78","uid":"1","topic":"1","content":"
\n

\u4e00\u3001\u5173\u4e8eDocker<\/strong><\/p> \n

\u4ec0\u4e48\u662fDocker\uff1fDocker \u91c7\u7528go\u8bed\u8a00\u7f16\u5199\uff0c\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5e94\u7528\u5bb9\u5668\u5f15\u64ce\u3002\u8ba9\u5f00\u53d1\u8005\u53ef\u4ee5\u5feb\u901f\u6253\u5305\u4ed6\u4eec\u7684\u5e94\u7528\u4ee5\u53ca\u4f9d\u8d56\u5305\u5230\u4e00\u4e2a\u5c01\u88c5\u7684\u53ef\u79fb\u690d\u7684\u5bb9\u5668Image\u4e2d\uff0c\u7136\u540e\u53d1\u5e03\u5230\u4efb\u4f55\u6d41\u884c\u7684\u673a\u5668\uff08 Linux \uff0cwindows\uff0cMac\u7b49\uff09\u4e0a\uff0c\u4e5f\u53ef\u4ee5\u5b9e\u73b0\u865a\u62df\u5316\u3002\u5bb9\u5668\u662f\u4f7f\u7528\u5b8c\u5168\u72ec\u7acb\u7684\u6c99\u7bb1\u673a\u5236\uff0c\u76f8\u4e92\u4e4b\u95f4\u4e0d\u4f1a\u6709\u4efb\u4f55\u63a5\u53e3\u3002\u53ef\u4ee5\u540c\u65f6\u8fd0\u884c\u591a\u4e2aContainer\uff0c\u4e14\u76f8\u4e92\u72ec\u7acb\u5404\u4e0d\u5e72\u6270\uff0c\u5bf9\u4e8e\u591a\u73af\u5883\u4e0b\u7684\u7cfb\u7edf\u6d4b\u8bd5\u975e\u5e38\u6709\u7528\uff0c\u4f46\u662fDocker\u7684\u5e94\u7528\u8fdc\u4e0d\u6b62\u6b64\u3002<\/p> \n

 <\/p> \n

\u4e8c\u3001\u5b89\u88c5<\/strong><\/p> \n

1. Windows 7\u7cfb\u7edf\u4e0b\u5efa\u8bae\u4f7f\u7528Docker toolbox\u65b9\u5f0f\u5b89\u88c5\uff0c\u7b80\u5355\u7c97\u66b4\u76f4\u63a5\u5feb\u901f\u7701\u4e8b\uff01<\/p> \n

\u3000\u3000\u3000\u3000https:\/\/www.docker.com\/products\/docker-toolbox<\/p> \n

\u3000Windows 10 \u7cfb\u7edf\u4e0b\u4f7f\u7528 Docker Coumunity Edition <\/p> \n

\u3000\u3000\u3000\u3000http:\/\/get.daocloud.io\/#install-docker-for-mac-windows<\/a> <\/p> \n

\u3000\u3000\u3000\u3000https:\/\/www.docker.com\/community-edition#\/windows<\/p> \n

2.\u56e0\u4e3a\u76ee\u524dwin7\u7cfb\u7edf\u5360\u591a\u6570\uff0c\u76f4\u63a5\u4ecb\u7ecdDocker toolbox\uff1a<\/p> \n

docker toolbox\u662f\u4e00\u4e2a\u5de5\u5177\u96c6\uff0c\u5b83\u4e3b\u8981\u5305\u542b\u4ee5\u4e0b\u4e00\u4e9b\u5185\u5bb9\uff1a<\/p> \n

\u3000\u3000\u3000\u3000\u30001\u3001Docker CLI \u5ba2\u6237\u7aef\uff0c\u7528\u6765\u8fd0\u884cdocker\u5f15\u64ce\u521b\u5efa\u955c\u50cf\u548c\u5bb9\u5668<\/p> \n

\u3000\u3000\u3000\u3000\u30002\u3001Docker Machine. \u53ef\u4ee5\u8ba9\u4f60\u5728windows\u7684\u547d\u4ee4\u884c\u4e2d\u8fd0\u884cdocker\u5f15\u64ce\u547d\u4ee4<\/p> \n

\u3000\u3000\u3000\u3000\u30003\u3001Docker Compose. \u7528\u6765\u8fd0\u884cdocker-compose\u547d\u4ee4<\/p> \n

\u3000\u3000\u3000\u3000\u30004\u3001Kitematic. \u8fd9\u662fDocker\u7684GUI\u7248\u672c<\/p> \n

\u3000\u3000\u3000\u3000\u30005\u3001Docker QuickStart shell. \u8fd9\u662f\u4e00\u4e2a\u5df2\u7ecf\u914d\u7f6e\u597dDocker\u7684\u547d\u4ee4\u884c\u73af\u5883<\/p> \n

\u3000\u3000\u3000\u3000\u30006\u3001Oracle VM Virtualbox. \u865a\u62df\u673a<\/p> \n

\u3000\u3000\u3000\u3000\u7531\u4e8eDocker\u5f15\u64ce\u7684\u5b88\u62a4\u8fdb\u7a0b\u4f7f\u7528\u7684\u662fLinux\u7684\u5185\u6838\uff0c\u6240\u4ee5\u6211\u4eec\u4e0d\u80fd\u591f\u76f4\u63a5\u5728windows\u4e2d\u8fd0\u884cdocker\u5f15\u64ce\u3002\u800c\u662f\u9700\u8981\u8fd0\u884cDocker Machine\u547d\u4ee4 docker-machine\uff0c \u5728\u4f60\u7684\u673a\u5668\u4e0a\u521b\u5efa\u548c\u83b7\u5f97\u4e00\u4e2aLinux\u865a\u62df\u673a\uff0c<\/p> \n

\u3000\u3000\u3000\u3000\u7528\u8fd9\u4e2a\u865a\u62df\u673a\u624d\u53ef\u4ee5\u5728\u4f60\u7684windows\u7cfb\u7edf\u4e0a\u8fd0\u884cDocker\u5f15\u64ce<\/p> \n

3.\u51c6\u5907\u5de5\u4f5c\uff1a<\/p> \n

Windows 7\u548c10 x64\uff0c\u652f\u6301Hyper-V<\/p> \n

\"\"<\/p> \n

4.\u5b89\u88c5Docker Toolbox<\/p> \n

\"\"<\/p> \n

\u4e0b\u8f7d\u5b8c\u6210\u540e\u5b89\u88c5\u3000\u3000<\/p> \n

\u3000\u3000\u3000\u3000\u5728\u8fd9\u4e00\u6b65\uff0c\u4f60\u5c06\u5b89\u88c5Docker Toolbox\u3002\u5b89\u88c5\u540e\u4f60\u7684\u7cfb\u7edf\u5c06\u4f1a\u5b89\u88c5\u4ee5\u4e0b\u51e0\u4e2a\u8f6f\u4ef6\uff1a<\/p> \n

\u3000\u3000\u3000\u30001\u3001Windows\u7248\u7684Docker\u5ba2\u6237\u7aef<\/p> \n

\u3000\u3000\u3000\u30002\u3001Docker Toolbox\u7ba1\u7406\u5de5\u5177\u548cISO\u955c\u50cf<\/p> \n

\u3000\u3000\u3000\u30003\u3001Oracle VM Virtualbox<\/p> \n

\u3000\u3000\u3000\u30004\u3001Git MSYS-git Unix \u5de5\u5177<\/p> \n

5.\u786e\u8ba4\u662f\u5426\u5b89\u88c5\u6210\u529f<\/p> \n

\u3000\u3000\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u4f1a\u5728\u4f60\u7684\u7535\u8111\u684c\u9762\u4e0a\u770b\u5230\u65b0\u589e\u4e86\u4e09\u4e2a\u56fe\u6807<\/p> \n

\u3000\u3000\u3000\u3000\"\"<\/p> \n

\u3000\u3000\u53cc\u51fbDocker Quickstart Terminal\u56fe\u6807\uff0c\u542f\u52a8\u4e00\u4e2a\u7ec8\u7aef<\/p> \n

\u3000\u3000\u7b2c\u4e00\u6b21\u542f\u52a8\u7684\u8bdd\u4f60\u4f1a\u770b\u5230\u547d\u4ee4\u884c\u4f1a\u8f93\u51fa\u4e00\u4e9b\u4e1c\u897f\uff0c\u7b49\u5f85\u4e00\u4e0b\uff0c\u5b83\u4f1a\u914d\u7f6eDocker Toolbox\uff0c\u4e4b\u540e\uff0c\u5f53\u5b83\u5b8c\u6210\u540e\uff0c\u4f60\u4f1a\u770b\u5230\u542f\u52a8\u6210\u529f\u7684\u753b\u9762<\/p> \n

\u3000\u3000\u82e5\u5728bash\u754c\u9762\u63d0\u793a\u6ca1\u6709boot2docker\u955c\u50cf\uff0c\u9700\u8981\u5728github\u4e0a\u4e0b\u8f7d\uff0c\u63d0\u793a\u5927\u6982\u5982\u4e0b<\/p> \n

 \"\"<\/p> \n

\u3000\u3000\u8fd9\u662f\u56e0\u4e3a\u6ca1\u6709\u627e\u5230\u9ed8\u8ba4\u7684boot2docker\u955c\u50cf\u7684\u539f\u56e0\uff0c\u63d0\u793a\u6b63\u5728\u4e0b\u8f7d\uff0c\u7136\u800cgithub\u7684\u4e0b\u8f7d\u901f\u5ea6\u4e0d\u53ef\u606d\u7ef4\uff0c\u7b2c\u4e00\u53cd\u5e94\u90fd\u662f\u627e\u522b\u7684\u7ad9\u8d44\u6e90\u4e0b\u8f7d\u3002<\/p> \n

\u5728\u6b64\u8981\u6ce8\u610f\u4e86\uff0c\u4e0d\u540c\u7684docker\u7248\u672c\u6700\u597d\u8981\u5bf9\u5e94\u76f8\u540c\u7684boot2docker\u7248\u672c\uff0c\u76f8\u4fe1\u6253\u5f00github\u4e0b\u8f7d\u9875\u7684\u5e94\u8be5\u90fd\u7559\u610f\u5230\u3002\u6700\u540e\u6211\u624d\u53d1\u73b0\uff0c\u5176\u5b9e\u4e0d\u7528\u4e0b\u8f7d\uff0c<\/p> \n

\u5728\u4e00\u5f00\u59cb\u5b89\u88c5\u597d\u7684DockerToolbox\u6839\u76ee\u5f55\u4e0b\u5c31\u6709\u4e00\u4e2aboot2docker\uff0c\u5e76\u4e14\u53ef\u4ee5\u63a8\u65ad\u5c31\u662f\u5bf9\u5e94\u7684\u7248\u672c\u3002<\/p> \n

\u3000\u3000\u3000\u3000\"\"<\/p> \n

\u3000\u3000\u628aboot2docker.iso\u590d\u5236\u5230\uff0cbash\u6240\u63d0\u793a\u627e\u4e0d\u5230\u7684\u90a3\u4e2a\u76ee\u5f55\u4e0b\uff08\u6211\u8fd9\u91cc\u662fC:\\Users\\Administrator\\.docker\\machine\\cache\uff09\u3002<\/p> \n

\u3000\u3000\u7136\u540e\u518d\u6b21\u53cc\u51fbDocker Quickstart Terminal\u56fe\u6807\uff0c\u51fa\u73b0\u5982\u4e0b\u754c\u9762\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u4e86\u3002<\/p> \n

\"\"<\/p> \n

 <\/p> \n

 \u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165docker run hello-world\u5e76\u6309\u56de\u8f66\u952e\uff0c\u5982\u679cdocker\u914d\u7f6e\u6210\u529f\u7684\u8bdd\uff0c\u4f60\u4f1a\u770b\u5230\u547d\u4ee4\u884c\u4e2d\u6709\u5982\u4e0b\u8f93\u51fa\uff1a<\/p> \n

\"\"<\/p> \n

windows\u4e0b\u5b89\u88c5\u597d\u4e86docker\u73af\u5883\u914d\u7f6e\u5b8c\u6210\u3002<\/p> \n

 <\/p> \n

\u4e09\u3001\u642d\u5efa\u4e00\u4e2a\u5305\u542bNodejs\u73af\u5883\u7684\u7b80\u5355webApp\u7684image<\/p> \n

1.\u672c\u5730\u914d\u7f6e\u5b8cNodejs\u73af\u5883\uff08\u53c2\u8003nodejs\u5b98\u7f51\uff1a https:\/\/nodejs.org\/en\/download\/\uff09<\/p> \n

2.\u53bbexpress\u5b98\u7f51\u4e0b\u8f7dgenerator<\/p> \n

\u53c2\u8003\u6b65\u9aa4\uff1a http:\/\/expressjs.com\/en\/starter\/generator.html<\/p> \n

3.\u5b89\u88c5\u540e\u5728\u5bf9\u5e94\u7684express\u5e94\u7528\u6587\u4ef6\u5939\u4e0b\u6bd4\u5982 C:\/myspp\uff1a<\/p> \n

\u65b0\u5efa\u6587\u4ef6Dockerfile\uff0c\u62f7\u8d1d\u4e0b\u9762code<\/p> \n

# Express-App
#
# VERSION 1.0.0<\/p> \n

FROM node:latest<\/p> \n

RUN mkdir -p \/home\/www\/express-app
WORKDIR \/home\/www\/express-app<\/p> \n

COPY . \/home\/www\/express-app
RUN npm install<\/p> \n

EXPOSE 3000
CMD ["npm", "start"]<\/p> \n

 <\/p> \n

\u7136\u540e\u53cc\u51fb\u684c\u9762DockerQuickStartTerminal\u56fe\u6807\uff0c\u8fdb\u5165DockerTerminal\u754c\u9762\uff1a<\/p> \n

\"\"<\/p> \n

 <\/p> \n

\u8df3\u8f6c\u5230\u521a\u624d\u5b89\u88c5\u7684express\u5e94\u7528\u6587\u4ef6\u8def\u5f84\uff1a cd C:\/myapp<\/p> \n

\"\"<\/p> \n

\u6ce8\u610f\u5728Docker Terminal\u4e2d\u6587\u4ef6\u8def\u5f84\u7684\u659c\u6760\u662f\u53cd\u7684<\/strong>\uff0c\u4e0e\u76f4\u63a5\u62f7\u8d1d\u51fa\u6765\u7684\u8def\u5f84\u4e0d\u540c\uff0c\u8981\u6539\u6210\u53cd\u659c\u6760\uff0c\u5426\u5219docker\u8df3\u8f6c\u4e0d\u4e86\u3002<\/p> \n

\u7136\u540e\u8f93\u5165 \uff1a docker build -t myapp .   \uff08\u6ce8\u610f\u540e\u9762\u7684\u70b9\uff09<\/p> \n

 \"\"<\/p> \n

\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p> \n

\"\"<\/p> \n

\"\"<\/p> \n

 <\/p> \n

 \u770b\u5230successfully build ***** \u5c31\u8868\u793aimage\u6784\u5efa\u6210\u529f\u4e86\u3002<\/p> \n

\u7136\u540e\u9a8c\u8bc1\u4e00\u4e0b\u662f\u4e0d\u662fimage\u5df2\u7ecf\u6709\u4e86\uff1a docker images<\/p> \n

\"\"<\/p> \n

\u53ef\u4ee5\u901a\u8fc7dicker history\u67e5\u770b\u955c\u50cf\u6784\u5efa\u8fc7\u7a0b\uff1a docker history myapp<\/p> \n

\"\"<\/p> \n

 <\/p> \n

\u7136\u540e\u628aimage run\u8d77\u6765\uff1adocker run  -p 3000:3000 myapp<\/p> \n

\"\"<\/p> \n

\u5982\u679c\u8981\u8ba9docker\u7ec8\u7aef\u540e\u53f0\u8fd0\u884c\uff1a \u5728\u53c2\u6570\u4e0a\u52a0 -d<\/p> \n

\u53ef\u4ee5\u901a\u8fc7docker ps\u67e5\u770b\u8fd0\u884c\u60c5\u51b5\uff1a<\/p> \n

\"\"<\/p> \n

 <\/p> \n

 \u5728\u672c\u5730\u6d4f\u89c8\u5668\u8f93\u5165\uff1a192.168.99.100:3000 \u67e5\u770b\u8fd0\u884c\u7684app\uff1a\uff08\u6ce8\u610f\u4f7f\u7528docker toolbox\u65f6\u4e0d\u662f\u4f7f\u7528127.0.0.1\uff0c\u800c\u662f\u8981\u4f7f\u7528\u542f\u52a8docker\u65f6\u5206\u914d\u7684\u90a3\u4e2aip\u5730\u5740\uff09<\/p> \n

\"\"<\/p> \n

 <\/p> \n

\u67e5\u770b\u6d4f\u89c8\u5668webapp\u8fd0\u884c\u60c5\u51b5\uff1a<\/p> \n

\"\"<\/p> \n

 \u53c2\u8003\u6587\u6863\uff1ahttps:\/\/www.cnblogs.com\/lujiangping\/p\/7206503.html<\/p> \n

                   http:\/\/www.jb51.net\/article\/104251.htm<\/p>\n<\/div>","orderid":"0","title":"Docker windows\u4e0b\u5b89\u88c5\u5e76\u642d\u5efaNodejs\u7684webapp","smalltitle":"","mid":"0","fname":"GO","special_id":"0","bak_id":"0","info":"0","hits":"336","pages":"1","comments":"0","posttime":"2017-11-15 09:15:14","list":"1510708514","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/images2015.cnblogs.com\/blog\/291765\/201707\/291765-20170719150937474-1420187095.png","ispic":"1","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"Docker<\/A> windows<\/A> \u5b89\u88c5<\/A> \u642d\u5efa<\/A> Nodejs<\/A> webapp<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.20.29.17","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"Docker windows\u4e0b\u5b89\u88c5\u5e76\u642d\u5efaNodejs\u7684webapp","lastview":"1713445589","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}