{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/9340","labels_url":"https://api.github.com/repos/docker/docker/issues/9340/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/9340/comments","events_url":"https://api.github.com/repos/docker/docker/issues/9340/events","html_url":"https://github.com/docker/docker/issues/9340","id":50082734,"number":9340,"title":"--link should be disallowed with --net=container","user":{"login":"gdm85","id":7117866,"avatar_url":"https://avatars.githubusercontent.com/u/7117866?v=3","gravatar_id":"","url":"https://api.github.com/users/gdm85","html_url":"https://github.com/gdm85","followers_url":"https://api.github.com/users/gdm85/followers","following_url":"https://api.github.com/users/gdm85/following{/other_user}","gists_url":"https://api.github.com/users/gdm85/gists{/gist_id}","starred_url":"https://api.github.com/users/gdm85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdm85/subscriptions","organizations_url":"https://api.github.com/users/gdm85/orgs","repos_url":"https://api.github.com/users/gdm85/repos","events_url":"https://api.github.com/users/gdm85/events{/privacy}","received_events_url":"https://api.github.com/users/gdm85/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/exp/beginner","name":"exp/beginner","color":"A8DBA8"},{"url":"https://api.github.com/repos/docker/docker/labels/status/claimed","name":"status/claimed","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-11-25T20:57:46Z","updated_at":"2015-04-06T20:29:41Z","closed_at":"2015-04-06T20:21:02Z","body":"I am trying to understand and use the ``--net=container`` feature. When I use a command like this:\r\n```\r\ndocker run -d --restart=no --cpu-shares=512 --link db:db -p 443 --net=container:other-web-app -v /etc/someVolume  --name=test-net-container base-image\r\n```\r\nI get this error:\r\n```\r\n2014/11/25 21:51:43 Error response from daemon: Cannot start container 1e02f12a2fdceb2f057f0cd58cf29ffe45790dc8ecae7be88456f79dccc58c7e: parent IP '' is invalid\r\n```\r\n\r\nI have not been able to find where this error is coming from (doesn't seem docker/libcontainer code), however it is my guess that you cannot link to a container when using ``--net=container`` mode. I got there by successfully running the same command without the ``--link`` option :\r\n```\r\ndocker run -d --restart=no --cpu-shares=512 -p 443 --net=container:other-web-app -v /etc/someVolume  --name=test-net-container base-image\r\n```\r\n\r\nIf I am not mistaken, shouldn't the ``--link`` option be disallowed (or at least a more explanatory error message given)?"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/90230567","html_url":"https://github.com/docker/docker/issues/9340#issuecomment-90230567","issue_url":"https://api.github.com/repos/docker/docker/issues/9340","id":90230567,"user":{"login":"estesp","id":1397980,"avatar_url":"https://avatars.githubusercontent.com/u/1397980?v=3","gravatar_id":"","url":"https://api.github.com/users/estesp","html_url":"https://github.com/estesp","followers_url":"https://api.github.com/users/estesp/followers","following_url":"https://api.github.com/users/estesp/following{/other_user}","gists_url":"https://api.github.com/users/estesp/gists{/gist_id}","starred_url":"https://api.github.com/users/estesp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estesp/subscriptions","organizations_url":"https://api.github.com/users/estesp/orgs","repos_url":"https://api.github.com/users/estesp/repos","events_url":"https://api.github.com/users/estesp/events{/privacy}","received_events_url":"https://api.github.com/users/estesp/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T20:29:41Z","updated_at":"2015-04-06T20:29:41Z","body":"Just a comment for posterity, given it may be confusing from prior comments across the various issues and PRs:\r\n\r\nWhat @coolljt0725 fixed in #11369 allows the use of `--link` where the link's target container actually was started with `--net=container:<some_running_container>`, and it even supports that recursively (if that target points its net to another running container which has it's net pointing to another container).  So, that fixed a valid problem, but what appears to still an issue (fixed at least by correcting the flag conflict check in #11686) is trying to start a container whose net is a pointer to another container, **and** link to yet another container at the same time.  This seems reasonable to block until we determine if that can be fixed (which would require adding the link target's IP into the parent net's container `/etc/hosts`, meaning we have linked the `--net=container:<other_container>` to the target as well, which may or may not be appropriate and needs some thought.\r\n"}}