No access to a linked container with docker run (mapping in /etc/hosts not exist) -


i have running mysql container name "drupaldistribution_mysql_1" (id 307b58c78108).

now want start container command tool named "drush", has access mysql container. use command:

$ docker run --link 307b58c78108:db --volumes-from drupaldistribution_data_1 -w /data/www/drupal drush/drush sqlc && cat /etc/hosts 

but /etc/hosts file in drush container not contain information linked container:

127.0.0.1   localhost 127.0.1.1 docker-host docker-host  # following lines desirable ipv6 capable hosts ::1     localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 

docker inspect on drush container returns:

$ docker inspect -f "{{ .hostconfig.links }}" 7d5f4cea983e  [/drupaldistribution_mysql_1:/tender_banach/db] 

i run docker version: docker version 1.6.2, build 7c8fca2 (inside of vagrant debian machine).

why there no reference in hosts file linked mysql container?

my guess issue due --volumes-from. try not share data between database , other containers. when try, have 127.0.1.1 docker-host docker-host line though part of local /etc/hosts?

also, can use name --link instead of id.

finally, if still fails, can pull ip environment. make sure mysql image exposes port , once link it, have db_port_xxxx_tcp_addr in environment.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -