docker-compose


cannot ping linked docker container service


having simple setup like this:
db:
image: mysql
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/myapp
ports:
- "3000:3000"
links:
- db:db
environment:
RAILS_ENV: development
if i run:
docker-compose build && docker-compose run web ping db
i get:
Starting myapp_db_1
ping: unknown host
why?
if i run:
docker-compose run cat /etc/hosts
i see this:
Starting myapp_db_1
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 4af9653f843a
(value 4af9653f843a changes on each run)
i am using docker-compose 1.6.2 and docker version 1.10.3 on mac os x (so virtualbox as well)
why does it happen? how can i access db container in web container by hostname?
ok i just realized that i need to run
docker-compose up
at least once before i can ping it

Related Links

How should docker-compose jobs discover etcd?
docker compose adding nodes dynamically to nginx frontend
Docker Swarm - dependencies definition
docker-compose volume not mounted
Exposing sentry service in docker-compose file
Yesod and docker-compose logs in development mode
Docker compose to always deploy using latest image
JHipster - Doubts in the development using Microservices Architecture
Gogs + Drone getsockopt: connection refused
Concourse result keeps loading
Docker-compose: AttributeError: 'module' object has no attribute 'ssl'
scaling a service with docker compose
Docker Compose apparently ignores COMPOSE_FILE
Where does Docker install gems on a mac
What is the difference between docker-machine and docker-compose?
Docker Compose port issue. Cannot launch docker project on localhost

Categories

HOME
actionscript-3
drupal
logging
model-view-controller
optimization
packet
x509certificate
bitbucket
mailchimp
grid
ms-access-2010
powerquery
opacity
flowtype
python-3.4
token
ejb-3.0
rename
minimax
angular-universal
wowza
mamp
mongodb-replica-set
drush
chef-recipe
repeater
jinja2
webseal
responsive
background-image
nsoperation
cucumberjs
xforms
ampscript
hololens
pixels
android-cursorloader
custom-fields
jms-topic
ds-5
login-required
tikz
offset
bootcamp
mockserver
aspose.pdf
susy
cakephp-3.2
niagara-ax
npoco
denodo
ionic2-select
history
wink
printer-control-language
dynatable
android-music-player
cedar-bdd
papyrus
jira-agile
change-password
qtruby
phpdesigner
usps
jmh
containstable
oryx
gtkwave
maven-antrun-plugin
windows-kernel
om
azure-mobile-app
tokudb
httpmodule
wingdb
applinks
qxorm
xcode5
drools-guvnor
fxmlloader
mind-manager
growl
livescript
cs193p
visual-studio-setup-proje
sendy
image-preloader
kernel-density
windows-phone-store
data-layers
kuka-krl
nativequery
static-class
oc4j
android-library
database-restore
boost.build
dnsbl
metapost
ncml
motordriver
big-endian
ios6-maps
nude.js
mvcmailer
jmesa
pinchzoom
virtual-printer
httppostedfilebase
execjs
numerical-computing
konsole
script-tag
tracd
memory-consumption

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App