{"id":3875,"date":"2021-01-01T20:30:44","date_gmt":"2021-01-01T11:30:44","guid":{"rendered":"https:\/\/tech.akat.info\/?p=3875"},"modified":"2021-01-01T20:33:25","modified_gmt":"2021-01-01T11:33:25","slug":"%e7%89%b9%e5%ae%9a%e3%81%aeip%e5%88%b6%e9%99%90%e3%81%8b%e3%82%89%e3%81%ae%e3%81%bf%e3%82%a2%e3%82%af%e3%82%bb%e3%82%b9%e5%8f%af%e8%83%bd%e3%81%aa%e3%82%b3%e3%83%b3%e3%83%86%e3%83%8a%e3%83%aa%e3%83%9d","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=3875","title":{"rendered":"\u7279\u5b9a\u306eIP\u5236\u9650\u304b\u3089\u306e\u307f\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306a\u30b3\u30f3\u30c6\u30ca\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u307b\u3057\u3044"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>IP\u5236\u9650\u3057\u305f\u30b3\u30f3\u30c6\u30ca\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u307b\u3057\u3044\u3002\u30b3\u30f3\u30c6\u30ca\u30ea\u30dd\u30b8\u30c8\u30ea\u3067\u601d\u3044\u3064\u304f\u306e\u306f\u4ee5\u4e0b\u3002<br \/>\n(1) dockerhub\u3092\u5229\u7528\u3059\u308b<br \/>\n(2) AWS ECR \u3092\u5229\u7528\u3059\u308b<br \/>\n(3) \u81ea\u5206\u3067\u69cb\u7bc9\u3059\u308b(\u53c2\u8003\uff1a<a href=\"https:\/\/daichan.club\/docker\/78588\">5\u5206\u3067\u793e\u5185\u306b\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306aDocker Registry\u3092\u7acb\u3066\u308b\uff01<\/a>)<\/p>\n<p>(1)\u306f\u3001\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u7279\u5b9a\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u5171\u6709\u3059\u308b\u65b9\u6cd5\u306f\u898b\u3064\u3051\u305f\u304c\u3001IP\u5236\u9650\u306f\u898b\u3064\u3051\u3089\u308c\u306a\u304b\u3063\u305f\u3002<br \/>\n<a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347-300x114.jpg\" alt=\"\" width=\"300\" height=\"114\" class=\"alignnone size-medium wp-image-3876\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347-300x114.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347-1024x389.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347-768x292.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347-1536x583.jpg 1536w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190347-2048x778.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>(3)\u306f\u3001\u624b\u9593\u306a\u306e\u3067\u3084\u308a\u305f\u304f\u306a\u3044\u3002<br \/>\n(2)\u3092\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<h2>AWS ECR\u3092\u5229\u7528\u3057\u3066\u307f\u308b<\/h2>\n<h3>\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u69cb\u7bc9<\/h3>\n<p><a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-300x87.jpg\" alt=\"\" width=\"300\" height=\"87\" class=\"alignnone size-medium wp-image-3877\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-300x87.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-1024x297.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-768x222.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-1536x445.jpg 1536w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_190436-2048x593.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\u540c\u3058\u30a4\u30e1\u30fc\u30b8\u30bf\u30b0\u540d\u3067\u30bf\u30b0\u3067\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u3068\u3001\u904e\u53bb\u306e\u30a4\u30e1\u30fc\u30b8\u306f\u30bf\u30b0\u306a\u3057\u3068\u306a\u308b\u3002<br \/>\n\u305d\u308c\u3092\u907f\u3051\u308b\u305f\u3081\u306b\u3001\u30bf\u30b0\u306e\u30a4\u30df\u30e5\u30fc\u30bf\u30d3\u30ea\u30c6\u30a3\u306f\u6709\u52b9\u306b\u3057\u3066\u3044\u308b\u3002<br \/>\n<a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608-300x243.jpg\" alt=\"\" width=\"300\" height=\"243\" class=\"alignnone size-medium wp-image-3878\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608-300x243.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608-1024x829.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608-768x622.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608-1536x1243.jpg 1536w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191608.jpg 1764w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744-300x183.jpg\" alt=\"\" width=\"300\" height=\"183\" class=\"alignnone size-medium wp-image-3879\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744-300x183.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744-1024x626.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744-768x469.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744-1536x939.jpg 1536w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191744.jpg 1635w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802-300x125.jpg\" alt=\"\" width=\"300\" height=\"125\" class=\"alignnone size-medium wp-image-3880\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802-300x125.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802-1024x426.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802-768x320.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802-1536x640.jpg 1536w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_191802-2048x853.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>IAM\u30e6\u30fc\u30b6\u306e\u4f5c\u6210<\/h3>\n<p>\u7279\u5b9aIP\u304b\u3089\u306e\u307f\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b SourceIPRestriction \u3068\u3044\u3046\u30dd\u30ea\u30b7\u30fc\u3092\u7528\u610f\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{\r\n  &quot;Version&quot;: &quot;2012-10-17&quot;,\r\n  &quot;Statement&quot;: &#x5B;\r\n    {\r\n      &quot;Sid&quot;: &quot;SourceIPRestriction&quot;,\r\n      &quot;Effect&quot;: &quot;Deny&quot;,\r\n      &quot;Action&quot;: &quot;*&quot;,\r\n      &quot;Resource&quot;: &quot;*&quot;,\r\n      &quot;Condition&quot;: {\r\n        &quot;NotIpAddress&quot;: {\r\n          &quot;aws:SourceIp&quot;: &#x5B;\r\n            &quot;x.x.x.x\/32&quot;\r\n          ]\r\n        }\r\n      }\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>\u203bECR\u306ePermissions\u3067\u3082\u64cd\u4f5c\u3067\u304d\u305d\u3046\u3060\u304c\u3001AWS\u30b5\u30fc\u30d3\u30b9\u3068\u9023\u643a\u3055\u305b\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081IAM\u30e6\u30fc\u30b6\u3067\u5236\u9650\u3057\u305f\u3002<br \/>\n\u3000\u53c2\u8003\uff1a<a href=\"https:\/\/docs.amazonaws.cn\/en_us\/AmazonECR\/latest\/userguide\/repository-policy-examples.html\">Repository policy examples<\/a><\/p>\n<p>SourceIPRestriction\u3068AmazonEC2ContainerRegistryPowerUser\u3092\u5408\u308f\u305b\u305f\u3001ecr_deploy \u3068\u3044\u3046IAM\u30e6\u30fc\u30b6\u3092\u4f5c\u6210\u3057\u305f\u3002<br \/>\n<a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709-300x175.jpg\" alt=\"\" width=\"300\" height=\"175\" class=\"alignnone size-medium wp-image-3881\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709-300x175.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709-1024x597.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709-768x447.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709-1536x895.jpg 1536w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_193709-2048x1193.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>\u30ea\u30dd\u30b8\u30c8\u30ea\u3078push\u3059\u308b<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nPS C:\\WINDOWS\\system32&gt; aws configure --profile=ecr_deploy\r\nAWS Access Key ID &#x5B;None]: AKIA...\r\nAWS Secret Access Key &#x5B;None]: Z4aU...\r\nDefault region name &#x5B;None]: ap-northeast-1\r\nDefault output format &#x5B;None]: json\r\n\r\nPS C:\\WINDOWS\\system32&gt; aws --version\r\naws-cli\/2.1.15 Python\/3.7.9 Windows\/10 exe\/AMD64 prompt\/off\r\n\r\nPS C:\\WINDOWS\\system32&gt; aws ecr get-login-password --region ap-northeast-1 --profile=ecr_deploy | docker login --username AWS --password-stdin 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\r\nLogin Succeeded\r\n\r\nPS C:\\WINDOWS\\system32&gt; docker tag nginx:latest 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test:1.0\r\n\r\nPS C:\\WINDOWS\\system32&gt; docker push 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test:1.0\r\nThe push refers to repository &#x5B;377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test]\r\n4eaf0ea085df: Pushed\r\n2c7498eef94a: Pushed\r\n7d2b207c2679: Pushed\r\n5c4e5adc71a8: Pushed\r\n1.0: digest: sha256:13e4551010728646aa7e1b1ac5313e04cf75d051fa441396832fcd6d600b5e71 size: 1362\r\n<\/pre>\n<h3>\u30ea\u30dd\u30b8\u30c8\u30ea\u3092pull\u3057\u3066\u307f\u308b<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nPS C:\\WINDOWS\\system32&gt; docker pull 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test:1.0\r\n1.0: Pulling from private-test\r\nDigest: sha256:13e4551010728646aa7e1b1ac5313e04cf75d051fa441396832fcd6d600b5e71\r\nStatus: Image is up to date for 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test:1.0\r\n377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test:1.0\r\n<\/pre>\n<p><a href=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_200643.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_200643-300x166.jpg\" alt=\"\" width=\"300\" height=\"166\" class=\"alignnone size-medium wp-image-3882\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_200643-300x166.jpg 300w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_200643-1024x567.jpg 1024w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_200643-768x425.jpg 768w, https:\/\/tech.akat.info\/wp-content\/uploads\/2021\/01\/2021-01-01_200643.jpg 1514w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h4>\u7279\u5b9aIP\u30a2\u30c9\u30ec\u30b9\u4ee5\u5916\u304b\u3089\u5b9f\u65bd\u3057\u305f\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u3068\u306a\u308b<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nPS C:\\WINDOWS\\system32&gt; docker pull 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test:1.0\r\nError response from daemon: pull access denied for 377343199566.dkr.ecr.ap-northeast-1.amazonaws.com\/private-test, repository does not exist or may require 'docker login': denied: User: arn:aws:iam::377343199566:user\/ecr_deploy is not authorized to perform: ecr:BatchGetImage on resource: arn:aws:ecr:ap-northeast-1:377343199566:repository\/private-test with an explicit deny\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 IP\u5236\u9650\u3057\u305f\u30b3\u30f3\u30c6\u30ca\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u307b\u3057\u3044\u3002\u30b3\u30f3\u30c6\u30ca\u30ea\u30dd\u30b8\u30c8\u30ea\u3067\u601d\u3044\u3064\u304f\u306e\u306f\u4ee5\u4e0b\u3002 (1) dockerhub\u3092\u5229\u7528\u3059\u308b (2) AWS ECR \u3092\u5229\u7528\u3059\u308b (3) \u81ea\u5206\u3067\u69cb\u7bc9\u3059\u308b(\u53c2\u8003\uff1a5\u5206\u3067\u793e\u5185\u306b\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306aDo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27,72],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/3875"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3875"}],"version-history":[{"count":2,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/3875\/revisions"}],"predecessor-version":[{"id":3884,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/3875\/revisions\/3884"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}