title: connection refused while trying to connect Golang to mssql server using docker
body: <p>I am trying to connect my golang program to a mssql server that I run on a container using docker. the golang is also running on a docker container. the go script seems to be able to successfully connect to the database, but can't perform any operation on it. So, </p>
  
  <pre><code>db, err := sql.Open("mysql","SA:YourStrong!Passw0rd@tcp(127.0.0.1:1433)/")
  
  if err != nil {
      panic(err)
  }
  
  defer db.Close()
  fmt.Println("Success open database")
  </code></pre>
  
  <p>This prints out the "success open database", however the next portion of the code  throws a panic,</p>
  
  <pre><code>_,err = db.Exec("CREATE DATABASE currency1")
  if err != nil {
      panic(err)
  }
  
  fmt.Println("Success CREATE database")
  </code></pre>
  
  <p>After using docker to build and run it, this is what I got</p>
  
  <pre><code>GO MYSQL START
  Success open database
  panic: dial tcp 127.0.0.1:1433: getsockopt: connection refused
  </code></pre>
  
  <p>This is the command I used to run the <code>mssql</code> database: </p>
  
  <pre><code>docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' -e 'MSSQL_PID=Express' -p 1433:1433 --name sql1 -d microsoft/mssql-server-linux:latest
  </code></pre>