Closed coderofsalvation closed 8 years ago
I think that using docker networking now solves this kind of thing. Just create a network and specify it for both containers
docker network create --driver overlay my-net
docker run ... --net my-net ....
You will end up with hosts entries for all containers in network in each container.
On 11 January 2016 at 15:32, coderofsalvation notifications@github.com wrote:
FYI: Just wrote this hook to easily link 2 containers both ways:
usage: connect_containers servernameA servernameB
connect_containers(){ host="$(crowdr exec $1 grep "$2" /etc/hosts)" [[ ${#host} == 0 ]] && { echo "$(get_ip $1) $1 $(crowdr_fullname "$1")" | crowdr pipe $2 tee /etc/hosts echo "$(get_ip $2) $2 $(crowdr_fullname "$2")" | crowdr pipe $1 tee /etc/hosts; } || echo "already connected!" }
the docker link parameter is nice, but I couldn't find any way to setup bidirectional links. (Correct me if I'm wrong please)
— Reply to this email directly or view it on GitHub https://github.com/polonskiy/crowdr/issues/20.
sweet! Unfortunately my ISP runs a particular (older version). As soon as they upgrade I'll use the 'network' cmd. I'll leave this here for other legacy docker users.
FYI: Just wrote this hook to easily link 2 containers both ways:
It works pretty sweet in combination with the
wait_port
function from the README.md example.