从另一个容器连接到Docker容器中的Azure存储模拟器?

时间:2018-03-14 02:36:08

标签: docker dockerfile dockerhub nginx-reverse-proxy azure-storage-emulator

我目前正在使用DockerHub中的microsoft / azure-storage-emulator映像(https://hub.docker.com/r/microsoft/azure-storage-emulator/)在Docker容器中运行Azure存储模拟器。

但是,我想要做的是从一个单独的Docker容器连接到模拟器。

看起来图像使用nginx反向代理(我不知道为什么微软会这样做)将请求转发给模拟器。

将模拟器配置文件更新为正在运行的容器的IP地址是相当直接的:

<StorageEmulatorConfig>
    <services>
        <service name="Blob" url="http://172.20.0.220:20000/"/>
        <service name="Queue" url="http://172.20.0.220:20001/"/>
        <service name="Table" url="http://172.20.0.220:20002/"/>
    </services>

...

但是,我试图找出我需要为nginx配置文件更改的内容,以便访问容器中的模拟器。

我认为server_name需要更新为正在运行的容器的名称,而proxy_pass需要使用容器的IP进行更新吗?

http {
proxy_http_version 1.1;
access_log off; # find way to redirect log to stdout on winodws

server {
    listen       10000;
    server_name  storage;

    location / {
        proxy_pass http://172.20.0.220:20000;
    }
}

server {
    listen       10001;
    server_name  storage;

    location / {
        proxy_pass http://172.20.0.220:20001;
    }
}

server {
    listen       10002;
    server_name  storage;

    location / {
        proxy_pass http://172.20.0.220:20002;
    }
}

当我从Microsoft基本映像构建我自己的映像时,我通过我的Dockerfile公开端口10000,10001和10002,这样容器就可以在那些端口上接收re :::

FROM microsoft/azure-storage-emulator
EXPOSE 10000 10001 10002

我使用DockerHub图像页面上推荐的连接字符串:

DefaultEndpointsProtocol = HTTP;帐户名= devstoreaccount1; AccountKey = Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq / K1SZFPTOtr / KBHBeksoGMGw ==; BlobEndpoint = HTTP:// {IP}:{blobport} / devstoreaccount1; TableEndpoint = HTTP:// {IP}:{tableport} / devstoreaccount1; QueueEndpoint = HTTP:// {IP}:{queueport} / devstoreaccount1;

但是当我尝试从另一个容器连接到模拟器容器时,我一直收到此错误消息:

Failed to execute installers: Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (504) Gateway Timeout. ---> System.Net.WebException: The remote server returned an error: (504) Gateway Timeout. at System.Net.HttpWebRequest.GetResponse() at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) --- End of inner exception stack trace --- at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Table.CloudTable.Create(TableRequestOptions requestOptions, OperationContext operationContext) at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext) at NServiceBus.AzureStorageQueues.AzureStorageQueueInfrastructure..ctor(SettingsHolder settings, String connectionString) at NServiceBus.AzureStorageQueueTransport.Initialize(SettingsHolder settings, String connectionString) at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NServiceBus.Hosting.Windows.InstallWindowsHost.Install(String username) at NServiceBus.Hosting.Windows.Installers.WindowsInstaller.RunInstall() Request Information RequestID: RequestDate:Wed, 14 Mar 2018 02:19:41 GMT StatusMessage:Gateway Time-out

所以,我不太清楚我需要做什么nginx配置文件更改才能让一个容器访问另一个容器中的模拟器,或者我想做什么甚至是可能的。

谢谢, MIK

0 个答案:

没有答案