question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set the ip of the docker container

See original GitHub issue

Hello, 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:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
adixiacommented, Apr 10, 2019

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.

1reaction
adixiacommented, Apr 2, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found