accessing a docker container from another another container

i created two docker containers based on two different images. one of db and another for webserver. both containers are running on my mac osx.

i can access db container from host machine and same way can access webserver from host machine.

  • RubyMine doesn't see gems from bundle in Docker on Mac OS
  • Docker - Karaf image with Mongo Image
  • How can I set up a Docker network with restricted communication?
  • docker boto3 AWS was not able to validate the provided access credentials
  • Cannot change Docker image directory
  • How can i mount /dev/shm in a docker container
  • however, how do i access db connection from webserver?

    the way i started db container is

    docker run –name oracle-db -p 1521:1521 -p 5501:5500 oracle/database:12.1.0.2-ee

    i started wls container as
    docker run –name oracle-wls -p 7001:7001 wls-image:latest

    I can access db on host by connecting to
    sqlplus scott/welcome1@//localhost:1521/ORCLCDB

    i can access wls on host as
    http://localhost:7001/console

  • How to Distribute Jenkins Slave Containers Within Docker Swarm
  • Fedora 22: ERROR: No module named '_rpmb' while building docker
  • Nginx proxy (jwilder/nginx-proxy) Connection reset by peer (502 Bad Gateway)
  • Unable to create a thinpool in Debian
  • How do I publish an ASP.NET Core application in a Docker container?
  • Spin off another container on host machine from an existing container
  • One Solution collect form web for “accessing a docker container from another another container”

    You will have to access db through the ip of host machine, or if you want to access it via localhost:1521, then run webserver like –

    docker run --net=host --name oracle-wls wls-image:latest
    

    See here

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.