Defining Custom IP range for Docker Containers

  1. What id default IP ranges are not available
  2. You need to add the range/IP to your firewall but don’t know because of it’s dynamic nature. etc.
  1. Define it with Docker-Compose.yaml file.
For Linux:networks:
mycustomnet:
driver: bridge
ipam:
config:
- subnet: 20.5.0.0/24
For Windows:networks:
mycustomnet:
driver: nat
ipam:
config:
- subnet: 20.5.0.0/24
For windows:{"fixed-cidr": "20.5.0.0/16"}For Linux:{"default-address-pools":[
{"base":"20.5.0.0/16","size":24}
]
}
Get-HNSNetwork | Remove-HNSNetwork -Verbose
Restart-Service Docker -Verbose
Verbose will display the result and it is optional in command

--

--

--

Passionate about Software designing & development and Learning Technologies and Love to share what I learn.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Shopify’s Ruby on Rails app statistics

Accessing Aws Cloud From CLI

Turn-Based Game With Go

Windows Server 2016 | Containers

PivotalTracker — A Fascinating Software Project Management Tool

Securing AWS Lambda using AWS ALB and Cognito / Okta / Auth0

Legacy: Reclaiming the Word

How to Build an App from Scratch in 10 Easy Ways

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Binod Mahto

Binod Mahto

Passionate about Software designing & development and Learning Technologies and Love to share what I learn.

More from Medium

Database, Entity Framework -1

C# Interface JSON Serialization and Deserialization

.NET Code coverage on GitLab

Recognize Audio Input as Text with Machine Learning in C#