title: How can a dockerfile expose SQL Server as localhost?
body: <p>Following the documentation on the microsoft/mssql-server-linux <a href="https://hub.docker.com/r/microsoft/mssql-server-linux/" rel="nofollow noreferrer">page</a>, it provides the following command to get a docker container running.</p>
  <p><code>docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Test!234' -p 1433:1433 -d --name sqllinux microsoft/mssql-server-linux</code></p>
  <p>This works fine and I'm able to open up SSMS and connect to <code>localhost</code> with the credentials:</p>
  <blockquote>
  <p>username: sa</p>
  <p>password: Test!234</p>
  </blockquote>
  <p>What I wanted to do after that is to create a <code>Dockerfile</code> that will create the image that will do the same thing:</p>
  <pre><code>FROM microsoft/mssql-server-linux
  
  ENV ACCEPT_EULA Y
  ENV SA_PASSWORD Test!234
  
  EXPOSE 1433 1433
  </code></pre>
  <p>I then ran <code>docker build . -t sqltestfile</code> followed by <code>docker run sqltestfile</code>.</p>
  <p>The container seems to start just fine and through Kitematic I can see (what looks like to me) the same output as running the other image, but I'm not able to connect to this image through SSMS using <code>localhost</code>.</p>
  <p>What needs to be changed about the <code>Dockerfile</code> to have it work the way I would expect (can connect to the container instance using SSMS through <code>localhost</code>)?</p>
  <p>Any help would be greatly appreciated!</p>