1

How to know network interface of the container after running docker ?

Requesting simple examples of setting firewall for the container in docker.

1 Answer 1

1

Ok, I asked that question on IRC. If you need to deny/allow access to something from all containers you can use lxcbr0 interface.

Ip addresses of each containers are changed dynamicly after containers are started. Iptables rules should be runned dynamicly after each container was started. It would possible after that issue https://github.com/dotcloud/docker/issues/252 would be resolved, inside hook you can run inspect command to know ip address, for example:

$ sudo ./docker inspect 7c0154dbf88c2498dda9d42e58b6d6f0896368fa986cb2559f08a424cf1107ac
2013/03/29 12:34:02 docker inspect 7c0154dbf88c2498dda9d42e58b6d6f0896368fa986cb2559f08a424cf1107ac
{
     //...
    "NetworkSettings": {
       "IpAddress": "10.0.3.2",
       "IpPrefixLen": 24,
       "Gateway": "10.0.3.1",
       "PortMapping": {}
    },
    //...
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.