Accessing running container (inside VM) from host OS

I have set up 3 Linux VM through multipass on my host Mac OSX. I have installed docker on these machines and started a 3 node docker swarm.

docker swarm init

After that, I have created 2 services one is for Postgres DB and the other is for drupal with the following command.

docker service create -d --name postgras-db --network test-swarm-network -e POSTGRES_PASSWORD=<password> postgres

docker service create -d  --name drupal-frontend --network test-swarm-network -p 80:80 drupal

Port 80:80 is exposed for drupal and both of these services are connected to the same overlay network. My services are up and running.

If I am doing everything on the host machine then I will simply do http://localhost:80 or http://localhost to get the desired output but now when running it in VM how I can test the drupal front from host MAC, i.e which IP to hit in the host browser to get the desired result.

P.S: There is nothing specific here about drupal (it could be any other container like Nginx etc), the question is about accessing running container (inside VM) from host OS



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation