0

I have setup a gitlab-ce docker container inside a VM(running Ubuntu 14.4). Once I run the docker image, I am able to access it on my network as 'machinename.local' where machinename is my VM. However, I would like to(if possible) access the docker gitlab image as 'gitlab.local' instead. I've tried publishing with different ports and IP, and tried setting the external URL within the gitlab.rb file. Is there a way to do this or am I just wasting my time?

2 Answers2

0

You want to publish the port (docker run -p 8080:80 ... if you wanted to publish port 8080 on the host to map to container port 80, these port numbers can be the same). Then you connect to your host ip/port to access your container service. So if your docker host is running on a VM, you'd connect to "http://vmhost:8080/", not "http://containerhost/".

BMitch
  • 5,966
  • 1
  • 25
  • 32
  • Why did this even get an upvote. He says he IS able to access it using a different hostname. What does network connectivity even have to do with this? Ridiculous. – Florin Asăvoaie Sep 02 '16 at 21:50
  • My apologies for ruining your day by mis-reading the question. I've seen quite a few questions asking how to directly access a container from outside the host using the container name from people that don't understand how exposing ports works and mistakenly believed that was what the OP was trying to do. – BMitch Sep 02 '16 at 22:15
0

You are making a confusion between DNS and network connectivity. Add a DNS entry for gitlab.local if you have control over the DNS server you are using or just map it in your hosts file.

Florin Asăvoaie
  • 7,057
  • 23
  • 35