How to setup IPs for dockers?


56 posts in this topic Last Reply

Recommended Posts

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

While any containers using the docker network to be deleted are stopped, just issue docker network rm dm-614e9ebdde75 to nuke the offending docker network.

Posted Images

With unRAID version 6.4 you just edit the docker container and choose a custom network, e.g. br0, as network type.

 

Optionally you can set a fixed IP address to the container, which must be within the subnet assigned to the interface (e.g. br0).

 

docker-ip-address.thumb.png.95af05171aaee73bd4100a859bbfc241.png

Link to post

Try stopping and restarting the Docker service (see settings page). Upon starting the Docker service it should find all available networks  (br0 in your case) and make them available in the dropdown list for the container.

 

Have you created any custom (macvlan) networks manually in the past? If so, these need to be deleted as they will interfere with the automatic creation in unRAID 6.4.

 

Link to post

The optional DHCP pool is used to defined a range of IP addresses for automatic assignment to containers in case a container is not given a fixed address. The range define here should not overlap which the IP range handed out by the regular DHCP server (usually your router) on the network.

 

When a DHCP pool is given, the network (br0) should also appear in the dropdown list.

What is the output of this command:

docker network ls

 

Link to post

 docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
fea497e4c33d        bridge              bridge              local
1e175f9bfa99        host                host                local
23bed2402df6        none                null                local
 

Link to post

It looks like creation of the custom network under docker is not successful.

 

What is the result of this command:

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=br0 br0

 

Link to post

The command I listed is the same command which will be automatically executed when the docker service is started.

 

Somehow network creation fails for lovingHDTV and I like that seen confirmed. Usually it means you need to delete the docker image and recreate the containers.

 

Link to post

Sorry it took so long, just got back from a business trip.

 

When I run it I get:

 

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=br0 br0
Error response from daemon: network dm-614e9ebdde75 is already using parent interface br0


 

Link to post

Right, docker has the interface already internally assigned. Unfortunately there is (or I don't know) a way to release the interface other then deleting the docker image and recreate the containers. This sounds drastic, but recreation of containers is a simple and fast thing to do by selecting the already present templates after the new docker image has been created.

 

Link to post
  • 2 weeks later...
On 11/5/2017 at 10:59 AM, ken-ji said:

While any containers using the docker network to be deleted are stopped, just issue


docker network rm dm-614e9ebdde75

to nuke the offending docker network.

 

I tested that but it doesn't work (docker tells the network is not existing and can't be deleted).

 

You'll need the sledgehammer approach :)  The following works:

rm /var/lib/docker/network/files/local-kv.db
/etc/rc.d/rc.docker restart

First the docker network file is deleted (it removes all known docker networks)

Next restart docker and networks are recreated, including the macvlan networks.

Link to post
  • 2 months later...

I have previously been using pipeworks to assign unique IP's to a few dockers, I thought I would move to the new inbuilt option, it works fine talking to the new docker from my network, but those dockers are not able to see the host, or any other dockers on the host.

 

my subnet is 192.168.0.0/24 and I am just entering the ip like 192.168.0.245.

 

Another question, is the MAC address that gets assigned to a docker in this fashion static, if I wanted to use DHCP?

 

Am I missing something?

Link to post

@Wob76

The limitation that prevents talking to the host is by design and the only way around it is to have either two or more network interfaces or to have VLANs in your network

see this for more details (This is the manual way for 6.3 not the automated way for 6.4)

@Diggewuff

Can you show us your network settings for docker?

 

 

Link to post

@ken-ji Thanks for the details, I guess I could look at setting up a VLAN, seems like an odd choice to be able to put a device on a LAN, but not have it talk to other device on the LAN (Host or otherwise). For the moment I'll just stick with pipeworks, it has been plodding along nicely for some time now.

Link to post

@bonienl Was wondering if I could get some help with this. Server has a quad NIC, and I'd like to take one of those and use it for one specific container, leaving the rest as they are (at least for now). I set the eth1 interface up with a static IP, and I'm able to choose that interface in the container template. When I start the container I am able to ping it locally just fine, but it cannot reach the internet. I've been all over the forums looking for an answer, and I'm sure its just me missing something, but any help would be appreciated.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.