{"id":1868,"date":"2015-05-23T20:37:52","date_gmt":"2015-05-23T11:37:52","guid":{"rendered":"http:\/\/mattyan.net\/blog\/?p=1868"},"modified":"2015-05-23T20:37:52","modified_gmt":"2015-05-23T11:37:52","slug":"virtualbox-archlinux-docker%e3%81%a7nginx%e3%82%92%e5%8b%95%e3%81%8b%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=1868","title":{"rendered":"VirtualBox + ArchLinux + Docker\u3067nginx\u3092\u52d5\u304b\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p>\u3042\u304f\u307e\u3067\u81ea\u5206\u5411\u3051\u306e\u30e1\u30e2\u3060\u304b\u3089\u3069\u3053\u304b\u9593\u9055\u3063\u3066\u308b\u304b\u3082<br \/>\n<!--more--><br \/>\n\u3068\u308a\u3042\u3048\u305a\u307e\u305a\u306f\u52d5\u3051\u3070\u3044\u3044\u3084\u3067<br \/>\n[bash]<br \/>\nmkdir dockertest<br \/>\ncd dockertest<br \/>\n[\/bash]<br \/>\n\u3067\u610f\u5473\u3082\u3042\u307e\u308a\u306a\u3051\u3069\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5165\u3063\u3066vim\u3067Dockerfile\u3092\u4f5c\u6210<\/p>\n<pre>\nFROM base\/archlinux\nRUN pacman -Syy --noconfirm\nRUN pacman -S --noconfirm nginx\nEXPOSE 80\nCMD [\"\/bin\/nginx\", \"-g\", \"daemon off;\"]\n<\/pre>\n<p>nginx\u306e\u7acb\u3061\u4e0a\u3052\u65b9\u3001\u672c\u5f53\u306b\u3053\u308c\u3067\u3044\u3044\u306e\u304b\u306a\u2026<br \/>\n\u3067\u3053\u308c\u3092docker build\u3067\u30a4\u30e1\u30fc\u30b8\u4f5c\u6210<br \/>\n[bash]<br \/>\ndocker build -t mattyan\/nginx .<br \/>\n[\/bash]<br \/>\n\u3084\u3063\u3066\u308b\u3053\u3068\u3068\u3057\u3066\u306f\u3001\u6700\u521d\u306bpacman\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3068\u540c\u671f\u3068\u3063\u3066(\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306f\u3057\u3066\u306a\u3044)nginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<br \/>\n\u3067\u30dd\u30fc\u30c880\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\u3057\u3066\u30a4\u30e1\u30fc\u30b8\u304c\u547c\u3070\u308c\u305f\u6642\u306bnginx\u3092\u30d5\u30a9\u30a2\u30b0\u30e9\u30a6\u30f3\u30c9\u30e2\u30fc\u30c9\u3067\u8d77\u52d5\u3002<br \/>\n\u5b9f\u884c\u30ed\u30b0<\/p>\n<pre>\nSending build context to Docker daemon 2.048 kB\nSending build context to Docker daemon\nStep 0 : FROM base\/archlinux\n ---> dce0559daa1b\nStep 1 : RUN pacman -Syy --noconfirm\n ---> Running in ab83051b78c9\n:: Synchronizing package databases...\ndownloading core.db...\ndownloading extra.db...\ndownloading community.db...\n ---> f2579d2201b9\nRemoving intermediate container ab83051b78c9\nStep 2 : RUN pacman -S --noconfirm nginx\n ---> Running in 44538fe31a22\nresolving dependencies...\nlooking for inter-conflicts...\nPackages (1): nginx-1.8.0-1\nTotal Download Size:    0.34 MiB\nTotal Installed Size:   0.98 MiB\n:: Proceed with installation? [Y\/n]\n:: Retrieving packages ...\ndownloading nginx-1.8.0-1-x86_64.pkg.tar.xz...\ndownloading nginx-1.8.0-1-x86_64.pkg.tar.xz...\ndownloading nginx-1.8.0-1-x86_64.pkg.tar.xz...\ndownloading nginx-1.8.0-1-x86_64.pkg.tar.xz...\ndownloading nginx-1.8.0-1-x86_64.pkg.tar.xz...\nchecking keyring...\nchecking package integrity...\nloading package files...\nchecking for file conflicts...\nchecking available disk space...\ninstalling nginx...\n ---> fa7dd7429c1a\nRemoving intermediate container 44538fe31a22\nStep 3 : EXPOSE 80\n ---> Running in c610d738ea89\n ---> 8cb66de7206f\nRemoving intermediate container c610d738ea89\nStep 4 : CMD \/bin\/nginx -g daemon off;\n ---> Running in 12fece796ff4\n ---> b5f07f3af17d\nRemoving intermediate container 12fece796ff4\nSuccessfully built b5f07f3af17d\n<\/pre>\n<p>\u3067\u3001\u30a4\u30e1\u30fc\u30b8\u304c\u3067\u304d\u305f\u3089<br \/>\n[bash]<br \/>\ndocker run -i -t -d -p 80:80 mattyan\/nginx<br \/>\n[\/bash]<br \/>\n\u3067\u5b9f\u884c\u3002<\/p>\n<pre>\n-p 80:80\n<\/pre>\n<p>\u3092\u5fd8\u308c\u308b\u3068\u5916\u304b\u3089\u30b3\u30f3\u30c6\u30ca\u306b\u63a5\u7d9a\u3067\u304d\u306a\u3044\u306e\u306b\u6ce8\u610f\u3002<br \/>\n[bash]<br \/>\ndocker ps<br \/>\n[\/bash]<br \/>\n\u3067\u8d77\u52d5\u4e2d\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u898b\u308b\u3068<\/p>\n<pre>\nCONTAINER ID        IMAGE                  COMMAND                CREATED             STATUS              PORTS                NAMES\na8e470239bab        mattyan\/nginx:latest   \"\/bin\/nginx -g 'daem   6 seconds ago       Up 4 seconds        0.0.0.0:80->80\/tcp   pensive_payne\n<\/pre>\n<p>\u3068\u30b3\u30f3\u30c6\u30ca\u304c\u52d5\u3044\u3066\u308b\u306e\u304c\u308f\u304b\u308b\u3002<br \/>\n\u3053\u306e\u72b6\u614b\u3067\u30db\u30b9\u30c8\u304b\u3089<br \/>\n[bash]<br \/>\ncurl localhost<br \/>\n[\/bash]<br \/>\n\u3059\u308b\u3068<br \/>\n[html]<br \/>\n&lt;!DOCTYPE html&gt;<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;title&gt;Welcome to nginx!&lt;\/title&gt;<br \/>\n&lt;style&gt;<br \/>\n    body {<br \/>\n        width: 35em;<br \/>\n        margin: 0 auto;<br \/>\n        font-family: Tahoma, Verdana, Arial, sans-serif;<br \/>\n    }<br \/>\n&lt;\/style&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;h1&gt;Welcome to nginx!&lt;\/h1&gt;<br \/>\n&lt;p&gt;If you see this page, the nginx web server is successfully installed and<br \/>\nworking. Further configuration is required.&lt;\/p&gt;<br \/>\n&lt;p&gt;For online documentation and support please refer to<br \/>\n&lt;a href=&quot;http:\/\/nginx.org\/&quot;&gt;nginx.org&lt;\/a&gt;.&lt;br\/&gt;<br \/>\nCommercial support is available at<br \/>\n&lt;a href=&quot;http:\/\/nginx.com\/&quot;&gt;nginx.com&lt;\/a&gt;.&lt;\/p&gt;<br \/>\n&lt;p&gt;&lt;em&gt;Thank you for using nginx.&lt;\/em&gt;&lt;\/p&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n[\/html]<br \/>\n\u3068\u8fd4\u3063\u3066\u304f\u308b\u306e\u3067\u3001\u3069\u3046\u3084\u3089\u7121\u4e8b\u306b\u52d5\u3044\u305f\u3088\u3046\u3060\u3002<br \/>\n<a href=\"http:\/\/mattyan.net\/blog\/wp-content\/uploads\/2015\/05\/docker_nginx.png\"><img decoding=\"async\" src=\"http:\/\/mattyan.net\/blog\/wp-content\/uploads\/2015\/05\/docker_nginx.png\" style=\"width: 100%\" alt=\"archlinux + docker + nginx\"><\/a><br \/>\nWindows(\u30db\u30b9\u30c8\u306eArch\u306e\u66f4\u306b\u30db\u30b9\u30c8)\u304b\u3089IE\u3067\u30a2\u30af\u30bb\u30b9\u3002<br \/>\n\u3055\u3041\u904a\u3076\u6e96\u5099\u304c\u3067\u304d\u305f\u305e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3042\u304f\u307e\u3067\u81ea\u5206\u5411\u3051\u306e\u30e1\u30e2\u3060\u304b\u3089\u3069\u3053\u304b\u9593\u9055\u3063\u3066\u308b\u304b\u3082<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"class_list":["post-1868","post","type-post","status-publish","format-standard","hentry","category-3","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1868"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1868\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}