{"id":9169,"date":"2018-12-17T01:21:35","date_gmt":"2018-12-16T16:21:35","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=9169"},"modified":"2019-01-14T01:23:07","modified_gmt":"2019-01-13T16:23:07","slug":"2018%e5%b9%b4-docker-%e4%bd%bf%e3%81%84%e6%96%b9-%e3%81%be%e3%81%a8%e3%82%81-%e3%81%9d%e3%81%ae3","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=9169","title":{"rendered":"2018\u5e74 Docker \u4f7f\u3044\u65b9 \u307e\u3068\u3081 \u305d\u306e3"},"content":{"rendered":"<div>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-8676\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/08\/20170131164247-300x268.png\" alt=\"\" width=\"300\" height=\"268\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/08\/20170131164247-300x268.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/08\/20170131164247-768x686.png 768w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2018\/08\/20170131164247.png 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/div>\n<p>\u3069\u3082\u3067\u3059\u3002<\/p>\n<p>\u524d\u56de\u306e\u300c<a href=\"https:\/\/www.webcyou.com\/?p=9115\">2018\u5e74 Docker \u4f7f\u3044\u65b9 \u307e\u3068\u3081 \u305d\u306e2<\/a>\u300d\u306e\u7d9a\u304d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>Docker\u516c\u5f0f\u30b5\u30a4\u30c8<\/strong><\/p>\n<p><a href=\"http:\/\/www.docker.com\" target=\"_blank\" rel=\"noopener\">www.docker.com<\/a><\/p>\n<div><\/div>\n<h4>Docker Hub<\/h4>\n<p>Docker Hub\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u4f5c\u6210\u3057\u305fdocker \u30a4\u30e1\u30fc\u30b8\u3092\u3001Docker Hub\u306e\u30ec\u30dd\u30b8\u30c8\u30ea\u306bpush\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30ec\u30dd\u30b8\u30c8\u30ea\u306bpush\u3059\u308b\u3053\u3068\u3067\u3001\u516c\u958b\u3057\u305f\u308a\u5171\u6709\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>docker hub<\/strong><\/p>\n<p><a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/hub.docker.com\/<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9198\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/bbc4991bc197ede42940f26409cf0dc1.png\" alt=\"\" width=\"634\" height=\"380\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/bbc4991bc197ede42940f26409cf0dc1.png 863w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/bbc4991bc197ede42940f26409cf0dc1-300x180.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/bbc4991bc197ede42940f26409cf0dc1-768x460.png 768w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4>Docker Hub\u3078\u30d7\u30c3\u30b7\u30e5<\/h4>\n<p>\u4f5c\u6210\u3057\u305fdocker \u30a4\u30e1\u30fc\u30b8\u3092<strong>Docker Hub<\/strong>\u306e\u30ec\u30dd\u30b8\u30c8\u30ea\u306bpush\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>Docker Hub\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3089\u3001docker\u30b3\u30de\u30f3\u30c9\u3067\u30ed\u30b0\u30a4\u30f3\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u30ec\u30b8\u30b9\u30c8\u30ea\u30b5\u30fc\u30d0\u30fc\u306b\u30ed\u30b0\u30a4\u30f3<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker login<\/pre>\n<p>docker login\u30b3\u30de\u30f3\u30c9\u3067\u3001Docker Hub\u306e\u30ed\u30b0\u30a4\u30f3\u304c\u884c\u3048\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30de\u30f3\u30c9\u5165\u529b\u5f8c\u3001Docker Hub\u3067\u4f5c\u6210\u3057\u305f\u30a2\u30ab\u30a6\u30f3\u30c8\u540d\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b<\/p>\n<p>\u300c<strong>Login Succeeded<\/strong>\u300d\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3059\u308c\u3070\u30ed\u30b0\u30a4\u30f3\u6210\u529f\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u307b\u304b\u306b\u3082\u3001<strong>Quay.io<\/strong>\u306b\u3082\u30ed\u30b0\u30a4\u30f3\u53ef\u80fd\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>Quay.io\u306b\u30ed\u30b0\u30a4\u30f3<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker\u00a0login quay.io<\/pre>\n<p>&nbsp;<\/p>\n<p>Docker Hub\u306b\u30a4\u30e1\u30fc\u30b8\u3092\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u30eb\u30fc\u30eb\u3068\u3057\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>DockerHub\u306b\u304a\u3051\u308b\u30bf\u30b0\u4ed8\u3051\u30eb\u30fc\u30eb<\/strong><\/p>\n<p>&lt;DockerID&gt;\/&lt;\u30a4\u30e1\u30fc\u30b8\u540d&gt;:\uff1c\u30bf\u30b0\u540d\uff1e<\/p>\n<p>&nbsp;<\/p>\n<p>\u30bf\u30b0\u540d\u306f\u7701\u7565\u53ef\u80fd\u3067\u3001\u7701\u7565\u3059\u308b\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u300clatest\u300d\u306e\u30bf\u30b0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u4f8b<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker tag docker-whale takayama\/docker-whale:1.0.0<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>push\u30b3\u30de\u30f3\u30c9<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker push \uff1cDockerID\uff1e\/\uff1c\u30a4\u30e1\u30fc\u30b8\u540d\uff1e:\uff1c\u30bf\u30b0\u540d\uff1e<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>pull\u30b3\u30de\u30f3\u30c9<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker pull takayama\/docker-whale:1.0.0<\/pre>\n<p>\u4e0a\u8a18\u306fDocker Hub\u306bpush\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u3092pull\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>nginx \u30a4\u30e1\u30fc\u30b8 web\u30b5\u30fc\u30d0\u30fc\u69cb\u7bc9<\/h4>\n<p>Docker Hub\u306b\u306f\u8272\u3005\u306a\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u30ec\u30dd\u30b8\u30c8\u30ea\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001nginx\u30a4\u30e1\u30fc\u30b8\u3092\u7528\u3044\u3066\u3001web\u30b5\u30fc\u30d0\u30fc\u3092\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9200\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/a8b22b5a9e5581686bbd1788a6806702.png\" alt=\"\" width=\"730\" height=\"293\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/a8b22b5a9e5581686bbd1788a6806702.png 1291w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/a8b22b5a9e5581686bbd1788a6806702-300x120.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/a8b22b5a9e5581686bbd1788a6806702-768x308.png 768w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/a8b22b5a9e5581686bbd1788a6806702-1024x411.png 1024w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>nginx\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u306f\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>dockerHub nginx\u516c\u5f0f<\/strong><\/p>\n<p><a href=\"https:\/\/hub.docker.com\/_\/nginx\" target=\"_blank\" rel=\"noopener\">https:\/\/hub.docker.com\/_\/nginx<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9201\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/dfae8a34ccc5c9136226ad6eae866bce.png\" alt=\"\" width=\"231\" height=\"130\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/dfae8a34ccc5c9136226ad6eae866bce.png 368w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/dfae8a34ccc5c9136226ad6eae866bce-300x169.png 300w\" sizes=\"auto, (max-width: 231px) 100vw, 231px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0a\u8a18\u306e\u30da\u30fc\u30b8\u306e <strong>Exposing external port<\/strong>\u306b\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u30b3\u30de\u30f3\u30c9\u3067\u5b9f\u884c\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name some-nginx -d -p 8080:80 some-content-nginx<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>nginx\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u7acb\u3061\u4e0a\u3052\u308b\u30b3\u30de\u30f3\u30c9<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name \uff1c\u30b3\u30f3\u30c6\u30ca\u540d\uff1e -d -p \uff1c\u30db\u30b9\u30c8\u5074\u306e\u30dd\u30fc\u30c8\u756a\u53f7\uff1e:\uff1c\u30b3\u30f3\u30c6\u30f3\u5074\u306e\u30dd\u30fc\u30c8\u756a\u53f7\uff1e \uff1c\u30a4\u30e1\u30fc\u30b8\u540d\uff1e<\/pre>\n<p>&nbsp;<\/p>\n<p>\u4efb\u610f\u306e\u30b3\u30f3\u30c6\u30ca\u540d\u3092\u6307\u5b9a\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u30b3\u30f3\u30c6\u30ca\u540d\u3067\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067Docker\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u300c-d \u300d\u306f\u3001\u30c7\u30bf\u30c3\u30c1\u30c9\u30e2\u30fc\u30c9\u3068\u8a00\u308f\u308c\u308b\u3082\u306e\u3067\u3001 \u6307\u5b9a\u304c\u306a\u3051\u308c\u3070\u3001\u30d5\u30a9\u30ef\u30b0\u30e9\u30f3\u30c9\u3067\u7acb\u3061\u4e0a\u304c\u308b\u306e\u3067\u3001\u4ed6\u306e\u64cd\u4f5c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u300c-p\u300d\u306f\u3001\u30dd\u30fc\u30c8\u756a\u53f7\u6307\u5b9a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name test-nginx -d -p 8080:80 nginx<\/pre>\n<p>&nbsp;<\/p>\n<p>\u65e9\u901f\u4e0a\u8a18\u306edocker\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30ed\u30fc\u30ab\u30eb\u306bdocker\u30a4\u30e1\u30fc\u30b8\u304c\u306a\u3044\u5834\u5408\u306f pull\u30b3\u30de\u30f3\u30c9\u304c\u884c\u308f\u308c\u3001<\/p>\n<p>\u30b3\u30f3\u30c6\u30caID\u304c\u8868\u793a\u3057\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>\u7121\u4e8b\u8d77\u52d5\u3067\u304d\u305f\u3089\u3001\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><a href=\"http:\/\/localhost:8080\/\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:8080\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9204\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/4cbdd8d67563dd4f43628110409f5b74.png\" alt=\"\" width=\"407\" height=\"174\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/4cbdd8d67563dd4f43628110409f5b74.png 528w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/4cbdd8d67563dd4f43628110409f5b74-300x128.png 300w\" sizes=\"auto, (max-width: 407px) 100vw, 407px\" \/><\/p>\n<p>nginx\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30da\u30fc\u30b8\u304c\u8868\u793a\u3057\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3044\u3068\u3082\u7c21\u5358\u306bnginx\u306e\u74b0\u5883\u304c\u7528\u610f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u505c\u6b62\u3068\u524a\u9664\u306e\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u505c\u6b62<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker stop\u00a0test-nginx<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u524a\u9664<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker rm test-nginx<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u300c-d\u300d\u306a\u3057\u3067\u3001\u30d5\u30a9\u30ef\u30b0\u30e9\u30f3\u30c9\u3067\u5b9f\u884c<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name test-nginx -p 8080:80 nginx<\/pre>\n<p>\u4e0a\u8a18\u306e\u300c-d\u300d\u306a\u3057\u306edocker\u30b3\u30de\u30f3\u30c9\u3092\u7528\u3044\u3066\u3001\u30d5\u30a9\u30ef\u30b0\u30e9\u30f3\u30c9\u3067\u8d77\u52d5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u8d77\u52d5\u5f8c\u3001\u518d\u5ea6 \u30d6\u30e9\u30a6\u30b6\u3067\u300c<a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>\u300d\u3092\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u304c\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">xxx.xx.x.x - - &#x5B;13\/Jan\/yyyy:hh:mm:ss +0000] \"GET \/ HTTP\/1.1\" 304 0 \"-\" \"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/71.0.3578.98 Safari\/537.36\" \"-\"<\/pre>\n<p>\u30d5\u30a9\u30ef\u30b0\u30e9\u30f3\u30c9\u3067\u8d77\u52d5\u3057\u305f\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u3059\u308b\u5834\u5408\u306f\u300cctl + c\u300d\u3067\u7d42\u4e86\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>\u30d0\u30a4\u30f3\u30c9\u30de\u30a6\u30f3\u30c8<\/h4>\n<h5>\u30dc\u30ea\u30e5\u30fc\u30e0<\/h5>\n<p><strong>Docker Hub nginx\u516c\u5f0f<\/strong><\/p>\n<p><a href=\"https:\/\/hub.docker.com\/_\/nginx\" target=\"_blank\" rel=\"noopener\">ttps:\/\/hub.docker.com\/_\/nginx<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9201\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/dfae8a34ccc5c9136226ad6eae866bce.png\" alt=\"\" width=\"231\" height=\"130\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/dfae8a34ccc5c9136226ad6eae866bce.png 368w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/dfae8a34ccc5c9136226ad6eae866bce-300x169.png 300w\" sizes=\"auto, (max-width: 231px) 100vw, 231px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u518d\u3073\u3001nginx\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u306e\u30da\u30fc\u30b8\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u300c<strong>Hosting some simple static content<\/strong>\u300d\u306e\u9805\u76ee\u306b\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u306f\u3001\u9759\u7684\u306ahtml\u30da\u30fc\u30b8\u3092\u914d\u7f6e\u3059\u308b\u30b3\u30de\u30f3\u30c9\u4f8b\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name some-nginx -v \/some\/content:\/usr\/share\/nginx\/html:ro nginx<\/pre>\n<p>\u5148\u7a0b\u3001nginx\u3092\u8d77\u52d5\u3057\u305f\u30b3\u30de\u30f3\u30c9\u306b \u300c-v\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4ed8\u4e0e\u3057\u3066\u8d77\u52d5\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name some-nginx -v \/some\/content:\/usr\/share\/nginx\/html:ro -d -p 8080:80 some-content-nginx<\/pre>\n<p>\u300c-v\u300d\u3092\u307f\u3066\u307f\u308b\u3068<\/p>\n<p><strong>\u300c-v \/some\/content:\/usr\/share\/nginx\/html:ro\u300d<\/strong><\/p>\n<p><strong>-v \uff1c\u30db\u30b9\u30c8\u5074\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff1e:\uff1c\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30de\u30a6\u30f3\u30c8\u30dd\u30a4\u30f3\u30c8\uff1e:\uff1c\u30aa\u30d7\u30b7\u30e7\u30f3\uff1e<\/strong><\/p>\n<p>\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u300cro\u300d \u306f\u30ea\u30fc\u30c9\u30aa\u30f3\u30ea\u30fc\u3068\u306a\u308a\u3001\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u30d0\u30a4\u30f3\u30c9\u30de\u30a6\u30f3\u30c8<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker\u00a0run \u2014name \uff1c\u30b3\u30f3\u30c6\u30ca\u540d\uff1e -d -v \uff1c\u30db\u30b9\u30c8\u5074\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff1e:\uff1c\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30de\u30a6\u30f3\u30c8\u30dd\u30a4\u30f3\u30c8\uff1e:\uff1c\u30aa\u30d7\u30b7\u30e7\u30f3\uff1e -p \uff1c\u30db\u30b9\u30c8\u5074\u306e\u30dd\u30fc\u30c8\u756a\u53f7\uff1e\uff1a\uff1c\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30dd\u30fc\u30c8\u756a\u53f7\uff1e \uff1c\u30a4\u30e1\u30fc\u30b8\u540d\uff1e<\/pre>\n<p>&nbsp;<\/p>\n<p>\u300c\u30db\u30b9\u30c8\u5074\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u300d\u306e\u30d1\u30b9\u306e\u6307\u5b9a\u306f\u7d76\u5bfe\u30d1\u30b9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u300c\u30b3\u30f3\u30c6\u30ca\u5074\u306e\u30de\u30a6\u30f3\u30c8\u30dd\u30a4\u30f3\u30c8\u300d\u3067\u306f\u3001nginx\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u516c\u958b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Mac\u306e\u5834\u5408<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">-v \/Users\/\uff1c\u30e6\u30fc\u30b6\u30fc\u540d\uff1e\/docker-test:\/usr\/share\/nginx\/html:ro<\/pre>\n<p>&nbsp;<\/p>\n<p>\/Users\/\uff1c\u30e6\u30fc\u30b6\u30fc\u540d\uff1e\/\u306f\u300c~\u300d\u306b\u7f6e\u304d\u63db\u3048\u308c\u307e\u3059\u3002<\/p>\n<p>\u300c\u30db\u30b9\u30c8\u5074\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u300d\u306b\u3001index.html \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ mkdir ~\/docker-test<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ vim\u00a0~\/docker-test\/index.html<\/pre>\n<p><strong>index.html<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;!doctype html&gt;\r\n&lt;html lang=&quot;ja&quot;&gt;\r\n&lt;head&gt;\r\n  &lt;meta charset=&quot;UTF-8&quot;&gt;\r\n  &lt;meta name=&quot;viewport&quot;\r\n        content=&quot;width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0&quot;&gt;\r\n  &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&gt;\r\n  &lt;title&gt;Document&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\nweb\u5e33 docker test\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>web\u5e33 docker test\u3068\u8a18\u8ff0\u3057\u305f\u3060\u3051\u306ehtml\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306edocker\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run --name test-nginx -v ~\/docker-test:\/usr\/share\/nginx\/html:ro -d -p 8080:80 nginx<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8d77\u52d5\u5f8c\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u300c<a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>\u300d\u3092\u30a2\u30af\u30bb\u30b9\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-9209\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/5cbbcdec020c50a471060b3a023ad754.png\" alt=\"\" width=\"224\" height=\"69\" \/><\/p>\n<p>\u4e0a\u8a18\u306e\u69d8\u306b\u300c~\/docker-test\u300d\u5185\u306b\u4f5c\u6210\u3057\u305f\u300cindex.html\u300d\u304c\u8868\u793a\u3059\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>Docker file COPY<\/h4>\n<p><strong>docker\u30b3\u30de\u30f3\u30c9\u306e\u300ccp\u300d<\/strong>\u3084\u3001<strong>DockerFile\u306e\u300cCOPY\u300d<\/strong>\u30b3\u30de\u30f3\u30c9\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001nginx\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name tmp-nginx \u2014rm -d nginx<\/pre>\n<p><strong>\u300c&#8211;rm\u300d\u30aa\u30d7\u30b7\u30e7\u30f3<\/strong>\u306f\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u3059\u308b\u3068\u3001\u30b3\u30f3\u30c6\u30ca\u3082\u524a\u9664\u3055\u308c\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p>\u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664\u305b\u305a\u3001\u540c\u540d\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u7528\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u305d\u306e\u969b\u306f\u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u304c\u3001<\/p>\n<p>\u300c&#8211;rm\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4ed8\u4e0e\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u8d77\u52d5\u3059\u308b\u3068\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u3068\u540c\u6642\u306b\u30b3\u30f3\u30c6\u30ca\u3082\u524a\u9664\u3055\u308c\u4fbf\u5229\u306a\u306e\u3067\u524a\u9664\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u4ed8\u4e0e\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>docker cp \u30b3\u30de\u30f3\u30c9<\/strong><\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u5148\u7a0b\u8d77\u52d5\u3057\u305f nginx\u306e\u30b3\u30f3\u30c6\u30ca\u304b\u3089\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081<\/p>\n<p><strong>docker\u306e \u300ccp\u300d<\/strong>\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u305e\u308c\u300c\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u2192\u30b3\u30f3\u30c6\u30ca\u5185\u300d\u300c\u30b3\u30f3\u30c6\u30ca\u5185\u2192\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u300d\u306e\u6307\u5b9a\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30f3\u30c6\u30ca\u5185\u306b\u30b3\u30d4\u30fc\u3059\u308b\u5834\u5408<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker cp \uff1c\u30db\u30b9\u30c8\u4e0a\u306e\u30b3\u30d4\u30fc\u3057\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\uff1e \uff1c\u30b3\u30f3\u30c6\u30ca\u540d or ID\uff1e\uff1a\uff1c\u30b3\u30d4\u30fc\u5148\u306e\u30d1\u30b9\uff1e<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u30b3\u30f3\u30c6\u30ca\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u306b\u30b3\u30d4\u30fc\u3059\u308b\u5834\u5408<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker cp \uff1c\u30b3\u30f3\u30c6\u30ca\u540d or ID\uff1e\uff1a\uff1c\u30b3\u30f3\u30c6\u30ca\u4e0a\u306e\u30b3\u30d4\u30fc\u3057\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\uff1e\uff1a\uff1c\u30b3\u30d4\u30fc\u5148\u306e\u30d1\u30b9\uff1e<\/pre>\n<p>&nbsp;<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u8d77\u52d5\u3057\u3066\u3044\u308bnginx\u306e\u30b3\u30f3\u30c6\u30ca\u304b\u3089\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u3067\u4f5c\u6210\u3057\u305f\u3001docker-test\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ cd docker-test\/<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>nginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u3068\u3063\u3066\u304f\u308b<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker cp tmp-nginx:\/etc\/nginx\/conf.d\/default.conf .\/<\/pre>\n<p>\u8d77\u52d5\u3057\u3066\u3044\u308b\u300ctmp-nginx\u300d\u304b\u3089nginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u300c\/etc\/nginx\/conf.d\/default.conf\u300d\u3092\u30b3\u30d4\u30fc\u3057\u3001<\/p>\n<p>\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u300cdocker-test\u300d\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ cat\u00a0default.conf<\/pre>\n<p>\u53d6\u5f97\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u53c2\u7167\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>listen 80;\u3092listen 8080;\u306b\u5909\u66f4\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ vim default.conf<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">listen 8080;<\/pre>\n<p>&nbsp;<\/p>\n<h4>Dockerfile\u3067\u30b3\u30f3\u30c6\u30f3\u5185\u306b\u9069\u5fdc<\/h4>\n<p>\u6700\u5f8c\u306b\u3001\u5148\u7a0b\u53d6\u5f97\u3057\u305fnginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308bdefault.conf\u3092\u3001<\/p>\n<p>nginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u306b\u30b3\u30d4\u30fc\u3067\u304d\u308b\u3088\u3046\u306bDockerfile\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u5148\u7a0b\u53d6\u5f97\u3057\u305f\u300cdefault.conf\u300d\u3068\u3001\u540c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n<p>Dockerfile\u306e\u8a18\u8ff0\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ vim dockerfile<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Dockerfile<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">FROM nginx:latest\r\nCOPY default.conf\u00a0\/etc\/nginx\/conf.d\/default.conf<\/pre>\n<p>\u4f5c\u6210\u3067\u304d\u307e\u3057\u305f\u3089\u3001\u30d3\u30eb\u30c9\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u30d3\u30eb\u30c9<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker build -t nginx:1.0.0 .<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30d3\u30eb\u30c9\u6210\u529f\u3057\u307e\u3057\u305f\u3089\u3001docker run\u30b3\u30de\u30f3\u30c9\u3067\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>nginx\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name web -p 8080:80 \u2014rm nginx:1.0.0<\/pre>\n<p>\u8d77\u52d5\u5f8c\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u300c<a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>\u300d\u3092\u30a2\u30af\u30bb\u30b9\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u307e\u307e\u3060\u3068\u30b3\u30f3\u30c6\u30ca\u5185\u306e\u30dd\u30fc\u30c880\u756a\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3044\u308b\u306e\u3067\u8868\u793a\u3057\u306a\u3044\u306e\u304c\u78ba\u8a8d\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u3092\u300c8080\u300d\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">$ docker run \u2014name web -p 8080:8080 \u2014rm nginx:1.0.0<\/pre>\n<p>\u518d\u5ea6\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u300c<a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a>\u300d\u3092\u30a2\u30af\u30bb\u30b9\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-9213\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/7ec473a2690589aeb3f27ec1abc6fae5.png\" alt=\"\" width=\"457\" height=\"186\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/7ec473a2690589aeb3f27ec1abc6fae5.png 560w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2019\/01\/7ec473a2690589aeb3f27ec1abc6fae5-300x122.png 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/p>\n<p>nginx\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30da\u30fc\u30b8\u304c\u8868\u793a\u3057\u3001nginx\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30dd\u30fc\u30c8\u304c\u300c8080\u300d\u306b\u5909\u66f4\u3055\u308c\u3066\u3044\u308b\u304c\u78ba\u8a8d\u3067\u304d\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u8a00\u3063\u305f\u308f\u3051\u3067\u3001\u7d9a\u304d\u306f\u6b21\u56de\u306b\u3067\u3082\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u3041\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u3069\u3082\u3067\u3059\u3002 \u524d\u56de\u306e\u300c2018\u5e74 Docker \u4f7f\u3044\u65b9 \u307e\u3068\u3081 \u305d\u306e2\u300d\u306e\u7d9a\u304d\u306b\u306a\u308a\u307e\u3059\u3002 Docker\u516c\u5f0f\u30b5\u30a4\u30c8 www.docker.com Docker Hub Docker Hub\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u4f5c\u6210 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[229],"tags":[172,171,59,177,176,37,47,169,107,180,173,58,150,45,55,178,114,118],"class_list":["post-9169","post","type-post","status-publish","format-standard","hentry","category-docker","tag-actionscript","tag-android","tag-android-sdk","tag-css3","tag-html5","tag-iphone-","tag-javascript-2","tag-mac","tag-mamp","tag-mysql","tag-php","tag-sdk","tag-vagrant","tag-web","tag-55","tag-178","tag-114","tag-118"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/9169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9169"}],"version-history":[{"count":19,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/9169\/revisions"}],"predecessor-version":[{"id":9216,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/9169\/revisions\/9216"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}