{"id":613,"date":"2018-12-06T00:58:07","date_gmt":"2018-12-05T15:58:07","guid":{"rendered":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/?p=613"},"modified":"2022-05-21T23:50:38","modified_gmt":"2022-05-21T14:50:38","slug":"ubuntu-server-18-04%e3%81%abdocker%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/archives\/613","title":{"rendered":"Ubuntu Server 18.04\u306bDocker\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b"},"content":{"rendered":"\n<p>OS: Ubuntu Server 18.04.1 LTS<\/p>\n\n\n\n<p>\u4e00\u53e3\u306bDocker\u3068\u4e91\u3063\u3066\u3082CE\u3068EE\u3068\u4e91\u30462\u3064\u306e\u30a8\u30c7\u30a3\u30b7\u30e7\u30f3\u304c\u5b58\u5728\u3057\u3001CE\u306f\u7121\u511f\u3067\u5229\u7528\u3067\u304d\u308bCommunity Edition\u3067\u3042\u308a\u3001EE\u304cEnterprise Edition\u3068\u3044\u3046\u6709\u511f\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u4e00\u5148\u305aapt search\u3067\u73fe\u308c\u305fdocker\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308c\u3070\u3088\u304b\u308d\u3046\u3068\u8003\u3048\u3001\u52e2\u3044\u52c7\u3093\u3067\u5c0e\u5165\u3057\u305f\u3051\u308c\u3069\u3082\u30b3\u30f3\u30c6\u30ca\u6280\u8853\u3068\u306f\u3061\u3063\u3068\u3082\u56e0\u7e01\u306e\u306a\u3044wmdocker\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3060\u3051\u3067\u4eca\u306e\u6240\u3001\u51fa\u756a\u306f\u306a\u3055\u305d\u3046\u306a\u60c5\u52e2\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ apt search docker\n(snip)\ndocker\/bionic 1.5-1build1 amd64\n  System tray for KDE3\/GNOME2 docklet applications<\/pre>\n\n\n\n<p>\u30b3\u30f3\u30c6\u30ca\u6280\u8853\u306b\u4fc2\u308b\u307b\u3046\u306eDocker\u3092\u5c0e\u5165\u3059\u308b\u624b\u7acb\u3066\u306f\u5e7e\u3064\u304b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u6a21\u69d8\u3067\u3001\u4e00\u3064\u306fDocker\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3059\u308b\u3082\u306e\u3067\u3042\u308b\u3002\u6216\u3044\u306fDocker\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3084\u308a\u53e3\u3082\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u4eca\u822c\u306fDocker\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u91dd\u3067\u8235\u53d6\u308a\u3092\u3059\u308b\u3002<a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\">\u516c\u5f0f\u30b5\u30a4\u30c8\u306e\u8aac\u660e\u66f8\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u624b\u5f15\u304d<\/a>\u304c\u8a18\u3057\u3066\u3042\u308b\u304b\u3089\u6b64\u308c\u3068\u7167\u3089\u3057\u5408\u308f\u305b\u306a\u304c\u3089\u4f5c\u696d\u3092\u9032\u3081\u3066\u3086\u304f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt update\n$ sudo apt install apt-transport-https ca-certificates curl software-properties-common\n$ curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -\nOK<\/pre>\n\n\n\n<p>\u516c\u958b\u9375\u3092\u8ffd\u52a0\u3057\u3066\u5176\u306e\u30d5\u30a3\u30f3\u30ac\u30fc\u30d7\u30ea\u30f3\u30c8\u3092\u78ba\u8a8d\u3059\u308b\u30029DC858229FC7DD38854AE2D88D81803C0EBFCD88\u306b\u30d4\u30bf\u30ea\u3068\u4e00\u81f4\u3059\u308b\u3082\u306e\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u306a\u3093\u3068\u306a\u304fdocker\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u30b5\u30fc\u30d0\u3078\u63a5\u7d9a\u3059\u308b\u3088\u3046\u306a\u8c6b\u899a\u3092\u611f\u3058\u53d6\u308c\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ apt-key list 9DC858229FC7DD38854AE2D88D81803C0EBFCD88\npub   rsa4096 2017-02-22 [SCEA]\n      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88\nuid           [ unknown] Docker Release (CE deb) &lt;docker@docker.com&gt;\nsub   rsa4096 2017-02-22 [S]<\/pre>\n\n\n\n<p>Docker\u306e\u516c\u5f0f\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3059\u308b\u306b\u3042\u305f\u3063\u3066\u306fCPU\u306e\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306b\u5408\u308f\u305b\u3066\u8a18\u8f09\u3059\u308b\u3002\u516c\u5f0f\u306e\u8aac\u660e\u66f8\u306b\u306f\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u6bce\u306b\u8a18\u8f09\u5185\u5bb9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u304b\u3089\u5927\u5909\u884c\u304d\u5c4a\u3044\u3066\u3044\u308b\u3002\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306f<code>uname -m<\/code>\u3042\u305f\u308a\u306e\u30b3\u30de\u30f3\u30c9\u304b\u3089\u63a8\u3057\u91cf\u3063\u3066\u8abf\u3079\u3092\u3064\u3051\u3066\u304a\u3051\u3070\u5b9c\u3057\u3044\u3068\u601d\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"<\/pre>\n\n\n\n<p>\u6b64\u306e\u64cd\u4f5c\u306b\u3088\u3063\u3066\/etc\/apt\/sources.list\u306b\u6b21\u306e\u4e8c\u884c\u304c\u633f\u5165\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cat \/etc\/apt\/sources.list\ndeb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu bionic stable\n# deb-src [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu bionic stable<\/pre>\n\n\n\n<p>\u65b0\u305f\u306a\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3057\u305f\u304b\u3089\u6b64\u51e6\u3067\u6539\u3081\u3066<code>apt update<\/code>\u3092\u5b9f\u884c\u3057\u3066\u30d1\u30c3\u30b1\u30fc\u30b8\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u540c\u671f\u3057\u3066\u304a\u304f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt update\nAll packages are up to date.<\/pre>\n\n\n\n<p>\u7136\u308a\u800c\u3057\u3066\u6108\u3005Docker\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u53ef\u80fd\u306b\u306a\u308b\u3002Docker\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u306fdocker-ce\u3067\u3042\u308b\u3068\u4e91\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt install docker-ce<\/pre>\n\n\n\n<p>Docker CE\u304c\u6b63\u3057\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u304b\u691c\u8a3c\u3059\u308b\u305f\u3081\u306bhello-world\u30a4\u30e1\u30fc\u30b8\u3092\u8d77\u52d5\u3059\u308b\u3002<code>This message shows that your installation appears to be working correctly.<\/code>\u3068\u306e\u63b2\u793a\u304b\u3089\u7533\u3057\u5206\u306a\u304f\u5c0e\u5165\u3055\u308c\u305f\u6a21\u69d8\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo docker run hello-world\nUnable to find image 'hello-world:latest' locally\nlatest: Pulling from library\/hello-world\nd1725b59e92d: Pull complete\nDigest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788\nStatus: Downloaded newer image for hello-world:latest\n\nHello from Docker!\n<strong class=\"orange\">This message shows that your installation appears to be working correctly.<\/strong>\n(snip)<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-content\/uploads\/2018\/11\/docker1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"366\" src=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-content\/uploads\/2018\/11\/docker1.png\" alt=\"\" class=\"wp-image-615\" srcset=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-content\/uploads\/2018\/11\/docker1.png 479w, https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-content\/uploads\/2018\/11\/docker1-300x229.png 300w\" sizes=\"auto, (max-width: 479px) 100vw, 479px\" \/><\/a><figcaption>\u56f31. hello-world\u30a4\u30e1\u30fc\u30b8\u3092\u8d77\u52d5\u3057\u305f\u69d8\u5b50<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3082\u3046\u5e7e\u3089\u304b\u8a66\u3057\u3066\u307f\u305f\u3044\u5411\u304d\u306b\u306f<code>docker run -it ubuntu bash<\/code>\u3067\u4ee5\u3063\u3066\u7c21\u7d20\u306aUbuntu\u3092\u5c0e\u5165\u3057\u3066\u69d8\u3005\u306a\u52d5\u4f5c\u3092\u691c\u8a3c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-content\/uploads\/2018\/11\/docker2.gif\"><img loading=\"lazy\" decoding=\"async\" width=\"570\" height=\"197\" src=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-content\/uploads\/2018\/11\/docker2.gif\" alt=\"\" class=\"wp-image-616\"\/><\/a><figcaption>\u56f32. \u30b3\u30f3\u30c6\u30ca\u5185\u3067bash\u3092\u7acb\u3061\u4e0a\u3052\u305f\u69d8\u5b50<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u53d6\u5f97\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u3092\u78ba\u8a8d\u3059\u308b\u5834\u5408\u306f\u3053\u3046\u3044\u3046\u5177\u5408\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo docker images\nREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\nhello-world         latest              4ab4c602aa5e        2 months ago        1.84kB\nubuntu              latest              93fd78260bd1        19 hours ago        86.2MB<\/pre>\n\n\n\n<p>1.84kB\u3082\u306e\u5bb9\u91cf\u3092\u5360\u62e0\u3059\u308bhello-world\u30a4\u30e1\u30fc\u30b8\u306f\u3082\u3046\u305f\u304f\u3055\u3093\u3060\u3068\u3044\u3046\u4e16\u8ad6\u304c\u9ad8\u307e\u308c\u3070<code>rmi<\/code>\u30b3\u30de\u30f3\u30c9\u306b\u3088\u3063\u3066\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u304b\u3089\u6b64\u308c\u3092\u8a66\u307f\u305f\u3068\u3053\u308d\u30b3\u30f3\u30c6\u30caID 0a105932ce9a\u306e\u30b3\u30f3\u30c6\u30ca\u304chello-world\u30a4\u30e1\u30fc\u30b8\u3092\u672a\u3060\u53c2\u7167\u3057\u3066\u3044\u308b\u4e8b\u3067\u524a\u9664\u306e\u59a8\u3052\u3068\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo docker rmi hello-world\nError response from daemon: conflict: unable to remove repository reference \"hello-world\" (must force) - container 0a105932ce9a is using its referenced image 4ab4c602aa5e<\/pre>\n\n\n\n<p>\u4e88\u3081rm\u30b3\u30de\u30f3\u30c9\u3067\u4ee5\u3063\u3066\u53c2\u7167\u3057\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664\u3057\u3066\u7686\u304chello-world\u306e\u30a4\u30e1\u30fc\u30b8\u306b\u898b\u5411\u304d\u3082\u3057\u306a\u3044\u72b6\u6cc1\u3078\u62bc\u3057\u8fbc\u3093\u3067\u3084\u308b\u3068\u826f\u3044\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo docker rm 0a105932ce9a\n0a105932ce9a<\/pre>\n\n\n\n<p>\u6539\u3081\u3066\u30a4\u30e1\u30fc\u30b8\u306e\u524a\u9664\u3092\u8a66\u307f\u308b\u3068\u7121\u4e8b\u3001\u96fb\u5b50\u306e\u85fb\u5c51\u3068\u5316\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo docker rmi 4ab4c602aa5e\nUntagged: hello-world:latest\nUntagged: hello-world@sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788\nDeleted: sha256:4ab4c602aa5eed5528a6620ff18a1dc4faef0e1ab3a5eddeddb410714478c67f\nDeleted: sha256:428c97da766c4c13b19088a471de6b622b038f3ae8efa10ec5a37d6d31a2df0b\n\n$ sudo docker images\nREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE<\/pre>\n\n\n\n<p>Docker\u306e\u4e0e\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u6982\u306d\u524a\u9664\u3057\u3066\u3057\u307e\u3046\u306a\u3089\u3053\u3046\u3044\u3046\u624b\u7d9a\u304d\u3067\u826f\u3055\u305d\u3046\u3067\u3042\u308b\u3002\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f\u81ea\u52d5\u3067\u524a\u9664\u3055\u308c\u306a\u3044\u304b\u3089\u624b\u52d5\u3067\u306e\u4f5c\u696d\u3092\u4f59\u5100\u306a\u304f\u3055\u308c\u308b\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt purge docker-ce\n$ sudo add-apt-repository --remove \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"\n$ sudo apt-key del 9DC858229FC7DD38854AE2D88D81803C0EBFCD88\n$ sudo rm -rfv \/var\/lib\/docker\/<\/pre>\n\n\n\n<h3 class=\"link\">\u53c2\u8003:<\/h3>\n<ul>\n <li><a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\">Get Docker CE for Ubuntu<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>OS: Ubuntu Server 18.04.1 LTS \u4e00\u53e3\u306bDocker\u3068\u4e91\u3063\u3066\u3082CE\u3068EE\u3068\u4e91\u30462\u3064\u306e\u30a8\u30c7\u30a3\u30b7\u30e7\u30f3\u304c\u5b58\u5728\u3057\u3001CE\u306f\u7121\u511f\u3067\u5229\u7528\u3067\u304d\u308bCommunity Edition\u3067\u3042\u308a\u3001EE\u304cEnterprise Edition\u3068\u3044\u3046\u6709\u511f\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u3088\u3046\u3067\u3042\u308b\u3002 \u4e00\u5148\u305aapt search\u3067\u73fe\u308c\u305fdocker\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308c\u3070\u3088\u304b\u308d\u3046\u3068\u8003\u3048\u3001\u52e2\u3044\u52c7\u3093\u3067\u5c0e\u5165\u3057\u305f\u3051\u308c\u3069\u3082\u30b3\u30f3 &#8230; <a title=\"Ubuntu Server 18.04\u306bDocker\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\" class=\"read-more\" href=\"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/archives\/613\" aria-label=\"Ubuntu Server 18.04\u306bDocker\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b \u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8aad\u3080\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":614,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[170],"tags":[194,165],"class_list":["post-613","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-170","tag-docker","tag-165"],"views":5776,"_links":{"self":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/posts\/613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=613"}],"version-history":[{"count":0,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/posts\/613\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/media\/614"}],"wp:attachment":[{"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www7390uo.sakura.ne.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}