swipely / iam-docker

Use different IAM roles for each Docker container on an EC2 instance
MIT License
211 stars 22 forks source link

Use a container's networks to find IP addresses #7

Closed nahiluhmot closed 8 years ago

nahiluhmot commented 8 years ago

When adding a container, the container store would look for the top level IPAddress field to find its IP. This works when the container is using the default network, but fails when the container is using a custom network. The container store now fetches the IPAddress field from each network to determine the IPs associated with the container.

@tlunter: Please review. @patagona-afriemann: Could you please validate that this works for your setup? I pushed the image to Docker Hub as swipely/iam-docker:56f9162.

tlunter commented 8 years ago

👍

nahiluhmot commented 8 years ago

Verified this locally, merging.

patagona-afriemann commented 8 years ago

Hey, sorry for the late reply, was swamped with work last week. We will check it out in the next days and I'll let you know if it works. The only issue I'd have could be a container with several networks, it might be necessary to specify the network. Apart from that thanks a lot for the quick fix :)

nahiluhmot commented 8 years ago

@patagona-afriemann I believe this should work with arbitrary networks. This change will not work if two containers have the same IP (even across networks), but that's impossible as far as I know.