1
In my hosts file I have only the following domains:
127.0.0.1 localhost
127.0.0.1 abc.com
When I will rotate the image I use the following command: docker run -p 80:80 -v /Users/userName/Documents/siteABC:/var/www/html my_image
. I can type in the URL abc.com
or localhost
and the site works using the Docker server as expected.
I was wondering if there is any way to create the host dynamically when I rotate the Docker image.
Example I wish I could write to the URL abcphp56.com
without me having to create that domain in my /etc/hosts
.
According to this post, if I understood correctly, just rotate the image with the following command: docker run -p 80:80 --add-host abcphp56.com:127.0.0.1 -v /Users/userName/Documents/siteABC:/var/www/html my_image
and I would have the system responsive to the 3 domains: localhost, abc with. and abcphp56.com, but it’s not working.
How could I do that?
So Luiz, this was a request from the programmer manager here at the company. So usually programmers access the system as abc.com. This container will be used as the default for all programmers, but he does not want each of the programmers to have to go to the /etc/hosts to edit some dns. He asked to do something like, create a list of dns inside the container that will respond when the user writes one of these urls in the host browser. So the list of dns already comes from the image.
– zwitterion
So from what I understand from your post, there’s no escape from editing the host hosts, right? Be automatic or manual.
– zwitterion
Dendro from your company you have a DNS, so doing on your DNS is all solved. I believe that your programmer does not know what you are asking, maybe I can help you: @luizcarlosfaria on Telegram. I think at the end of the day, he’s asking for something that could be simpler.
– Luiz Carlos Faria