link to localhost using docker as provider

10 views
Skip to first unread message

Eddy Hernandez

unread,
Dec 1, 2016, 7:38:02 PM12/1/16
to Vagrant
Hi everyone
Maybe you can help me to get this questions


I'm using docker as a provider, I have two containers: container1 and service1 I need to reach the service1:4505 from the container1
the docs says that is posible using link e.g. "service1:service1" but I would like to reach the service using localhost, It's possible?

The main idea is something like this: link "service1:localhost" but this is not possible


Eddy Hernandez

unread,
Dec 2, 2016, 9:05:02 AM12/2/16
to Vagrant
I made a test and it seems that work well the following.

link: "author:localhost"

I don't like to add this configuration on each container, I would like to expose alway the service in the localhost. Any idea on how to do it?

Alvaro Miranda Aguilera

unread,
Dec 2, 2016, 9:07:40 PM12/2/16
to vagra...@googlegroups.com
each docker container have a separate networking

so localhost inside one container is separate to the network in the other container

is like having 2 physical machines, and you want to access a remote service.
could you explain a bit why you require localhost for a remote service ?


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/397beadb-8577-4bbb-81f5-b858e2363b79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Eddy Hernandez

unread,
Dec 5, 2016, 8:57:11 AM12/5/16
to Vagrant
HI Alvaro,

I have a development environment, this is a workstation where the developer can use it as a developer machine.
The developer can use the following services containers inside his local environment (VM with docker containers)

e.g.

services:
- service1 (at port 8080)
- service2 (at port 4500)

containers:
- tool1 (maven)
- tool2 (maven)
- tool3 (git)
- another containers

The idea is to provide tools to build against the services, tool1 is used to build and deploy against the service1 that means that tool1 contains d.link("service1: service1") to access to the service1, but in some cases the developer wants to build his project without deploying to a service1 (maybe service1 does not exist or is not created), for those cases I use tool2 that has the same configuration of tool1 but does not have link option. (service1 is not needed)

The idea of expose the service available for all containers, I like to remove tool2 and use tool1 for both cases.

I hope you understand me. =0)

El viernes, 2 de diciembre de 2016, 20:07:40 (UTC-6), Alvaro Miranda Aguilera escribió:
each docker container have a separate networking

so localhost inside one container is separate to the network in the other container

is like having 2 physical machines, and you want to access a remote service.
could you explain a bit why you require localhost for a remote service ?

On Fri, Dec 2, 2016 at 1:38 AM, Eddy Hernandez <eddy...@gmail.com> wrote:
Hi everyone
Maybe you can help me to get this questions


I'm using docker as a provider, I have two containers: container1 and service1 I need to reach the service1:4505 from the container1
the docs says that is posible using link e.g. "service1:service1" but I would like to reach the service using localhost, It's possible?

The main idea is something like this: link "service1:localhost" but this is not possible


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages