Is there a way to specify hostname when starting container on azure cloud instance

坚强是说给别人听的谎言 提交于 2019-12-06 16:09:11

问题


I have been trying to setup a docker image on Azure and am running into an issue. The image has been designed to require a -h hostname argument when starting it using the docker commands.

The image is here: https://hub.docker.com/r/sverhoeven/cartodb/

I can't translate these commands into something I can do on Azure.

The options for -h are as follows:

How to use a different hostname:

For example to use cartodb.example.com as a hostname start with:

docker run -d -p 80:80 -h cartodb.example.com sverhoeven/cartodb 

The chosen hostname should also resolve to an IP adress of the machine where the web server is running. If you don't have a domain/subdomain pointing to your server yet, you can use the servers external ip address:

docker run -d -p 80:80 -h <servers-external-ip-address> sverhoeven/cartodb

Here is what happens by not telling the image what hostname to use - Note, when you don't specify the hostname, it defaults to localhost. I am seeing a lot of 127.0.0.1 in the log output and some references to localhost. That is concerning.:

Started GET "/" for 127.0.0.1 at 2018-06-20 01:53:59 +0000
Processing by Admin::PagesController#index as */*
...
Redirected to http://localhost/login
...
Started GET "/favicon.ico" for 127.0.0.1 at 2018-06-20 01:54:25 +0000
ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
...
Started POST "/sessions/create" for 127.0.0.1 at 2018-06-20 01:54:39 +0000
Started GET "/user/dev/dashboard/" for 127.0.0.1 at 2018-06-20 01:54:39 +0000

I am looking for suggestions or solutions.

Note: This is tangentially related to another question I asked concerning the carto image here.


回答1:


After going around and around, the short answer is no, this is not possible right now. Workaround is to use an environment variable



来源:https://stackoverflow.com/questions/50959411/is-there-a-way-to-specify-hostname-when-starting-container-on-azure-cloud-instan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!