I need to connect my db container with my server container. Now I just red about the legacy parameter --link
, which works perfect
$> docker run -d -P --name rethinkdb1 rethinkdb
$> docker run -d --link rethinkdb:db my-server
But, if this parameter will be dropped eventually, how would I do something like the above ?
The docs says to use the
docker network
command instead (which is available since Docker 1.9.0 - 2015-11-03)Instead of
you will now use
Note that in the new form, container names are used, while before you were able to define an alias.
When two containers are part of the same network, their
/etc/hosts
file is updated so that you can use the container names instead of their IP addresses.