在Azure云实例上启动容器时是否可以指定主机名 [英] Is there a way to specify hostname when starting container on azure cloud instance

查看:90
本文介绍了在Azure云实例上启动容器时是否可以指定主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Azure上设置docker映像,但遇到了问题。
使用docker命令启动该映像时,该映像设计为需要-h主机名参数。

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.

该映像位于此处:>://://hub.docker.com/r/sverhoeven/cartodb/

我无法将这些命令转换为可以在Azure上执行的操作。

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

-h的选项如下:


如何使用其他主机名:

要将cartodb.example.com用作主机名,以以下开头:

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



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




所选的主机名还应解析为运行Web服务器的计算机的IP地址。
如果您还没有指向服务器的域/子域,则可以使用服务器的外部ip地址:

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

这是不告诉图像使用哪个主机名的结果-注意,当您不指定主机名,默认为localhost。我在日志输出中看到很多127.0.0.1,并且有一些对localhost的引用。令人担忧。

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.

注意:这与我询问的有关carto图像的另一个问题相切相关此处

推荐答案

一遍又一遍,简短的回答是否,这不可能。解决方法是使用环境变量

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

这篇关于在Azure云实例上启动容器时是否可以指定主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆