{"id":507,"date":"2016-11-28T15:02:05","date_gmt":"2016-11-28T14:02:05","guid":{"rendered":"http:\/\/btrnaidu.com\/?p=507"},"modified":"2017-07-21T13:08:28","modified_gmt":"2017-07-21T11:08:28","slug":"assign-static-ip-to-docker-container","status":"publish","type":"post","link":"https:\/\/btrnaidu.com\/index.php\/assign-static-ip-to-docker-container\/","title":{"rendered":"Assign static ip to docker container"},"content":{"rendered":"<p>At the core, docker does not allow you to assign static ip to its containers. \u00a0You can do so but by defining your own private network. \u00a0Below tutorial does this:<\/p>\n<p>First of all, you need to define your own network. \u00a0Something like below:<\/p>\n<pre>  docker network create --driver=bridge --subnet=172.10.0.0\/16 --ip-range=172.10.1.0\/24 --gateway=172.10.1.254 private<\/pre>\n<p>Next all is left is, pass\u00a0below arguments to your run command.<\/p>\n<pre>\u00a0 docker run\u00a0--network=private  --ip 172.10.1.1 --name container_name container_to_launch<\/pre>\n<p>This way your container gets a static ip address which is 172.10.1.1 in this case.<\/p>\n<p>View the available network using command<\/p>\n<pre>  docker network ls<\/pre>\n<p>&nbsp;<\/p>\n<p>[tweetthis]Assign static ip to docker container[\/tweetthis]<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At the core, docker does not allow you to assign static ip to its containers. \u00a0You can do so but by defining your own private network. \u00a0Below tutorial does this: First of all, you need to define your own network. \u00a0Something like below: docker network create &#8211;driver=bridge &#8211;subnet=172.10.0.0\/16 &#8211;ip-range=172.10.1.0\/24 &#8211;gateway=172.10.1.254 private Next all is left &hellip; <a href=\"https:\/\/btrnaidu.com\/index.php\/assign-static-ip-to-docker-container\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Assign static ip to docker container<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":7,"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":541,"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/posts\/507\/revisions\/541"}],"wp:attachment":[{"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/btrnaidu.com\/index.php\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}