At work, we have a Docker Compose YAML file will allow the programmer to run an MS SQL Server-based docker image as a container.
Please keep in mind that there are configurations for 3 images ( 2 Database images & 1 Hasura GraphQL image ) in said Docker Compose YAML file:
a) Microsoft SQL Server Database which is used by the application in question that is being developed
b) PostgreSQL database and a database instance specifically for storing Hasura's Metadata info data
c) Hasura GraphQL instance
Here are the steps that I take to run said YAML file in docker.
Start the docker desktop application.
Retrieve said Docker Compose YAML file, and place it in a directory on your local computer.
In this gitlab.com repo's Docker Compose YAML file, default HOST_PORT and CONTAINER_PORT numbers were entered, therefore, navigate to said directory within Microsoft Power Shell, and run the following command:
docker-compose -f ms_sqlserverdocker-compose.yml up
Unfortunately, I sometime get the following error message Erratically when I run the Microsoft SQL Server Database container ( i.e. sql-server-db ) :
The error states the following: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:1433 -> 0.0.0.0:0: listen tcp 0.0.0.0:1433: bind: An attempt was made to access a socket in a way forbidden by its access permissions
( I usually resolve the aforementioned error by restarting my local computer which is really onerous because it’s sort a pain to restart the computer in order to to free up a port )
The aforementioned error comes up erratically in my local computer.
When I the following netstat command in my MS Dos commandline window, it returns nothing which is strange:
Microsoft Windows [Version 10.0.19045.2965] (c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>netstat -ano | find "1433"
C:\Windows\system32>
If netstat searches for port 1433 , and return nothing then does it mean that port “1433” is available and open for use? If yes then why is docker complaining with the following message when I attempt to connect to port 1433 within my local computer?
An attempt was made to access a socket in a way forbidden by its access permissions
( I usually resolve the aforementioned error by restarting my local computer which is really onerous because it’s sort a pain to restart the computer in order to to free up a port )
Does anyone know why the 1433 port becomes erratically unavailable? Furthermore, is there a more elegant way of freeing up said port?