docker-compose


URL for cloudant on docker compose


Using the docker compose, I'm trying to get my app to call the cloudant URL with the following values, but always get connection refused:
http://admin:pass#0.0.0.0:8080
http://admin:pass#cloudant:8080
But if I go to http://0.0.0.0:8080/dashboard.html, I can access the cloudant web console.
Here is my compose file (referencing the sample in Running Cloudant as docker container with docker compose)
version: '2.1'
services:
app:
build: app/
links:
- cloudant
cloudant:
image: ibmcom/cloudant-developer:latest
container_name: cloudant-testdb
ports:
- "8080:80"
expose:
- "80"
volumes:
- cloudant:/srv
mem_limit: 256M
restart: always
privileged: true
network_mode: bridge
volumes:
cloudant:
Here is how I got this to work:
Specify the hostname for the cloudant container in your docker-compose file like so:
restart: always
hostname: cloudant
privileged: true
When communicating between containers you use the ports exposed by the services in the container, not the ports that are defined in the mapping. In this case you use the port exposed by Cloudant which is 80. So, your URL should look like this:
http://admin:pass#cloudant
Set the network_mode value to bridge in the app container.
Here is a working example: https://github.com/markwatsonatx/tutorial-cloudant-nodejs-intro
Also, be sure to accept the license in Cloudant and initialize the database. You may need to restart docker-compose after doing so.

Related Links

Name an image built from running a docker-compose file
Race conditions after changing names in docker-compose.yml
Docker compose - image not found
How to work out the hostname that compose gives containers?
docker-compose restart container if service is dead
Swarm scheduling not working as expected using filters in compose file
issues in buiding Slate with Docker
Invalid type error in Docker Compose
Django cookiecutter with Docker add pip package
Docker Compose + Swarm + Machine Networking issue
docker-compose build image parameters --force-rm --pull
linking 2 containers through docker compose
Files created by manage.py commands not chown'd from root user
Is it possible to create an intermediate image within docker-compose?
docker-compose service listen on specified interface
Does Docker-Compose allow overwriting of ports when using extends?

Categories

HOME
youtube-api
alasql
grpc
abc
windows-server-2008
reference
readdir
magento-1.9.2.1
where
terminal
angularjs-directive
webpack-dev-server
yacc
openbsd
distinct
decoding
lambda-calculus
hql
views
orange
accordion
bug-reporting
ejb-3.1
klipfolio
javaagents
ecmascript-2017
poisson
mobile-development
deferred
multilanguage
kubectl
directions
contextmenustrip
oracle-nosql
snapkit
traitsui
mootools
ragel
leaderboard
maven-2
iterm2
var
redbean
smooth-streaming
cakephp-3.2
qtwebkit
hierarchical-clustering
easyquery
remap
hdpi
dotnet-cli
htop
codesniffer
was
group
google-scholar
android-tabs
joystick
altova
tinybox2
diameter-protocol
3d-rendering
archiva
nd4j
instabug
matlab-engine
ios8-share-extension
recode
edgar
notice
self-join
xml-simple
litedb
avd
strcpy
cordova-3
information-hiding
conditional-comments
vundle
windows-search
visual-studio-setup-proje
xps
dylan
grape-api
octokit
qgraphicsscene
stringstream
removeall
string-length
cron4j
openafs
beep
facebook-winjs-sdk
nsundomanager
copyfile
cgaffinetransform
umfpack
method-call
noise-reduction
conditional-operator
mysql-pconnect
dgml
disk-based

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