Валера Соловьев asked:
I need to bind a container with storage-legacy to another app2-legacy, but I need that application inside the app2-legacy can connect to storage-legacy throught localhost.
I know about
`docker run -P -ti –rm –name app2-legacy –link storage-legacy:storage-legacy mystorage-legacy app.sh
But I need connect throught 127.0.0.1. How I can do this?
You can put two containers in the same network namespace, which means they will share the
lo interface and each container’s process can access ports from the other container via localhost.
Do this with
docker run container1 docker run --net=container:container1 container2
Note that the containers will also share their other network interfaces, such as external network connections.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.