How to share host network bridge when using docker in docker -


i'm using https://github.com/jpetazzo/dind docker image have docker in docker. when starting docker containers inside parent docker, possible use bridge of parent docker can share network between containers inside docker container , parent docker container?

what want access containers inside parent docker container host directly ip assign domain names them.

update -> main idea

i'm upgrading free online java compiler allow users run program using docker. i'm using dind (docker in docker image) launch main container have inside java program receive requests , launch docker containers inside of it. want give users option run programs expose port , let them access containers using subdomain. graphically have hierarchy

internet -> host -> main docker container -> user docker container 1                                              -> user docker container 2                                              -> user docker container n 

and want give user subdomain name access "user docker container" example: www.user_25.compiler1.browxy.com

so can have program expose port in "user docker container" , can access using subdomain www.user_25.compiler1.browxy.com

what confuses me access "user docker container" need access before main docker container. i'm trying find way access "user docker container" directly, thought if user docker container , main docker container can share same network can access user docker container directly host , assign domain name "user docker container" ip updating /etc/hosts file on host.

thanks lot advice or suggestion :)

if run "main docker container" --net=host, configuration simplifies to:

internet -> host -> user docker container 1                  -> user docker container 2                  -> user docker container n 

although want use bridge other docker0 child containers (e.g., create new bridge docker1, , start dind docker daemon -b docker1).

if 2 users attempt publish service on same port @ same ip address, yes, have port conflicts. there few ways of working around this:

  1. if can support multiple public ip addresses on host, can "assign" (in quotes because not automatic) 1 each container. instead of running docker run -p 80:80 ..., need make bind ip explicit, docker run -p 80:80:1.2.3.4. requires people "play nice"; is, there nothing prevent either forgetting specify bind address or specifying wrong address.

  2. if explicitly running web services, may able use sort of front-end proxy map subdomain names containers using name-based virtual host. there several components process, , making automated require little work. doing manually comparatively easy (just update /etc/hosts, example), fragile because when container restarted have new ip address. a dynamic dns service can this.

these suggestions more solutions, let me know if more details. there other ways of cracking particular nut, else chime in.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -