how to map database from couchdb container to another containers webapp in same docker-compose file

I am having one web application which is running with couchdb database.
This coudb container has multiple databases from which web application need only one database.
I am using docker compose to run it but web application didn’t recognize database inside couchdb container
by docker-compose.yml file as below

version: "2"
services:
    db:
      image: mysite/couch:latest
      ports:
       - "15984:5984"
      environment:
         DB_USER: admin
         DB_PASSWORD: password
         DB_NAME: db_new
    webapp:
      image: mysite/webapp:latest
      ports:
       - "3050:3000"
      links:
       - db
       - db:db_new

If I run docker manually as mentioned below it works fine

  • ffmpeg failed - 455 Method Not Valid in This State
  • Execute host shell script from meteor container
  • Generated files on host from docker
  • Stream app logs from folder to stdout while app running within docker
  • Getting the latest version of Android SDK for Ubuntu using wget
  • docker swarm http connectivity
  • docker run --rm -e DB_URL=http://localip:15984/db_new -p 0.0.0.0:3050:3000
    

    Any Ideas what I am missing in docker-compose file?

  • sharing of OS image resources across multiple docker containers
  • TensorFlow in nvidia-docker: failed call to cuInit: CUDA_ERROR_UNKNOWN
  • Connectivity issue to Cassandra cluster from Docker container (Java)
  • PEPS mail, smtp able to send email externally but not receiving
  • build Docker images from GitLab
  • Can't start or list docker Machines created on another partition
  • One Solution collect form web for “how to map database from couchdb container to another containers webapp in same docker-compose file”

    After spending lots of time on docker-compose I got the solution as below

    version: "2"
    services:
        db:
          image: mysite/couch:latest
          ports:
           - "15984:5984"
        webapp:
          image: mysite/webapp:latest
          ports:
           - "3050:3000"
          links:
            - db
          environment:
             DB_URL: http://admin:password@db:5984/db_new
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.