It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Connecting to MS SQL Server in container

Deleted user Oct 27, 2017

We've got a Python-based app server running on a Linux image. We're trying to connect to a Linux container running SQL Server on port 1433.

We're using unixODBC and FreeTDS, and everything works when creating a local network (`docker network create --driver bridge --subnet 172.21.0.0/24 our_network.bridge`), then adding the containers to the network. Then we can access SQL Server's data source by name (`docker run -itd --network=our_network.bridge --name local-mssql microsoft/mssql`), local-mssql in this case.

We can `telnet 127.0.0.1 1433`, so the port is open. But using unixODBC command line tool isql (parameters: server name, username, password), this is the result:


+ isql -v sqlserver sa supersecret
[ISQL]ERROR: Could not SQLConnect
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name.

Any idea how we can access to our database?

1 answer

1 vote

Hey @[deleted], I'm not super familiar with unixODBC, but I can talk about the general network set up.

When using Pipelines services, the processes running inside these containers all share a network interface with the main step execution container. This is why you can access everything via localhost / 127.0.0.1, and why there can be no port conflicts between services (can't run nginx and apache on port 80 for example).

As a common rule, each service must listen for connections from localhost/127.0.0.1, and the clients should connect to localhost.

Is it possible your command 

isql -v sqlserver sa supersecret 

is trying to connect to a remote host named 'sqlserver' and not `localhost` ?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

1,088 views 3 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you