tomcat - How to map the IP address of docker container to another container dynamically -


i have few docker containers running in host. have scenario need map ip address of 1 container configuration file available in container. know can ip address of container using docker inspect [container] command. assumes ip address assigned dynamically every time restart container. every time need change ip address in container. possible have static ip container or can use ip address of host instead of ip address of container. new docker world.

also have case need map ip address container running in host. example, have redis container running in hosta , tomcat container running in hostb. in order communicate redis tomcat, need map ip address , port of redis in tomcat container. how can achieved in docker ?

you can run linked containers in documentation - linking containers:

docker run -itd --name=container4 --link container5:c5 image docker run -itd --name=container5 --link container4:c4 image 

and ping second container by alias (c5):

docker attach container4  / # ping -w 4 c5 ping c5 (172.25.0.5): 56 data bytes 64 bytes 172.25.0.5: seq=0 ttl=64 time=0.070 ms 

so can see it's possible ping second container with alias - not ip address.

to second quesiton: it's possible if have redis , tomcat , know ip addresses of each other (and accessible because in network), configuration of network.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -