title: Connecting to Azure Storage Emulator in a Docker container from another container?
body: <p>I'm currently using the microsoft/azure-storage-emulator image from DockerHub (<a href="https://hub.docker.com/r/microsoft/azure-storage-emulator/" rel="nofollow noreferrer">https://hub.docker.com/r/microsoft/azure-storage-emulator/</a>) to run Azure Storage Emulator in a Docker container.</p>
  
  <p>However, what I'd like to do is to connect to the emulator from a separate Docker container.</p>
  
  <p>It looks like the image uses an nginx reverse proxy (I have no idea why Microsoft did this) to forward the requests to the emulator.</p>
  
  <p>Updating the emulator config file to the IP address of the running container is fairly straight foward:</p>
  
  <pre><code>&lt;StorageEmulatorConfig&gt;
      &lt;services&gt;
          &lt;service name="Blob" url="http://172.20.0.220:20000/"/&gt;
          &lt;service name="Queue" url="http://172.20.0.220:20001/"/&gt;
          &lt;service name="Table" url="http://172.20.0.220:20002/"/&gt;
      &lt;/services&gt;
  </code></pre>
  
  <p>...</p>
  
  <p>BUT, I am trying to figure out what I need to change for the nginx config file in order to get access to the emulator in the container.</p>
  
  <p>I think <code>server_name</code> needs to be updated to the name of the running container and the <code>proxy_pass</code> needs to be updated with the IP of the container?</p>
  
  <pre><code>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;
      }
  }
  </code></pre>
  
  <p>I'm exposing ports 10000, 10001 and 10002 via my Dockerfile when I go to build my own image from the Microsoft base image so the container can receive requetss on that those ports:</p>
  
  <pre><code>FROM microsoft/azure-storage-emulator
  EXPOSE 10000 10001 10002
  </code></pre>
  
  <p>I'm using the connection string recommended on the DockerHub's image page:</p>
  
  <p>DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://{ip}:{blobport}/devstoreaccount1;TableEndpoint=http://{ip}:{tableport}/devstoreaccount1;QueueEndpoint=http://{ip}:{queueport}/devstoreaccount1;</p>
  
  <p>But I keep receiving this error message when trying to connect to the emulator container from another container:</p>
  
  <p><code>
  Failed to execute installers: 
  Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (504) Gateway Timeout. ---&gt; 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.&lt;Initialize&gt;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
  </code></p>
  
  <p>So, I'm not too sure what nginx config file changes I need to make in order for the one container to access the emulator in the other container or if what I want to do is even possible.</p>
  
  <p>Thanks,
  Mik</p>