Set the ip of the docker container
See original GitHub issueHello,
I would like to create a docker container from a dockerfile and set its IP, e.g 1.1.1.1, on a custom network called mynetwork, like this:
docker run --net mynetwork --ip '1.1.1.1' -it mycontainer
is it possible with FluentDocker?
Thank you for the support Alessandro
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Assign static IP to Docker container
This command will run a Docker container with a random IP like 172.17.0.5, but I need to assign a specific IP to the...
Read more >How to Assign a Static IP to a Docker Container
Static IP addresses don't change when containers or services are stopped and started, making them useful for permanent networking. Assigning ...
Read more >Assign Static IP to Docker Container and Docker-Compose
Learn how Docker manages IP allocation and how to add a static address to a container.
Read more >How to Provide the Static IP to a Docker Container?
Docker is an open-source project that makes it easier to create, deploy and run applications. · Solution: · Step 1: Configure the Docker...
Read more >Manually Specifying the IP Address of a Container
Manually specifying an IP address when using the Weave Net Docker Proxy ... You can specify an IP address and a network explicitly,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi Mario, I’ve inspected deeper this issue and i found that the problem is the parameters order in the command. The proper command should be: ‘docker run --net mynetwork --ip ‘1.1.1.1’ -it mycontainer’. the --ip flag has to be added as the next command after the name of the custom network, otherwise it doesn’t work. Sorry for bothering you, I hope you can help me.
Have a nice day.
Hi Mario, I am sorry but I am a junior Developer and I don’t know how to do the unit Tests correctly…
Anyway I created my own network and then I tried to set the ip of the newer container to one in that network via fluent API, but it raises me this exception :
user specified IP address is supported on user defined networks only Error: failed to start containers....I think this happens because the “–ip” arguments has to be added after the name of the custom network, and I don’t know if this is possible with the API… Thank you for the support.