Trouble Connecting My Redmine Container to SQL Server

0
7
Asked By CuriousCoder42 On

Hello everyone! I'm having a tough time getting my Redmine container to connect to a SQL Server that's running on my Windows machine. I'm using the following Docker command to run the container:

docker run -d --name redmine-sqlserver -p 8090:3000
-e REDMINE_DB_SQLSERVER=192.168.1.16
-e REDMINE_DB_PORT=1433
-e REDMINE_DB_DATABASE=redmine
-e REDMINE_PLUGINS_MIGRATE=1
-e REDMINE_DB_USERNAME=aselsan
-e REDMINE_DB_PASSWORD=xxxxxxxxxxxxxx

neydju/redmine:v2

I've checked everything – firewall settings, SQL Server security, and I can connect to SQL Server using SSMS without issues. The connection works fine when I switch to a MySQL database, but with SQL Server, the container doesn't seem to connect at all. I'm really at a loss here!

4 Answers

Answered By WindowsWarrior On

What setup are you using? If your SQL Server runs directly on Windows (especially if you're using Docker Desktop or WSL), be mindful that network connections can sometimes be tricky. Loopback connections may fail. A cleaner approach might be running Docker in a Linux VM, like Debian, which simplifies access.

CuriousCoder42 -

Is there a straightforward way to initiate a TCP connection to the database on port 1433 from within the container? I’m looking for command suggestions.

Answered By NetNinja101 On

Is your container actually starting up without problems? If it is, check the logs – those might give clues as to why it can't connect to the SQL Server. If you don't see anything indicating a SQL timeout or an error, it might be defaulting to the built-in SQLite database instead, which could be the reason you’re not seeing any connections.

CuriousCoder42 -

Yes, the container starts fine, and I can access my app. The logs show general activity with no SQL Server-related messages.

Answered By TechWhiz88 On

It looks like your host port mapping is a bit confusing. You’re mapping port 8090 (host) to 3000 (container), but SQL Server runs on port 1433. Ensure that the application inside the container tries to connect using the right port. Check that it points to the SQL Server database correctly and is using the same IP you're trying to access externally.

HelpfulHacker27 -

Just to clarify, your database connection should still be routed through 192.168.1.16:1433 and not be influenced by the web app's port mapping. Make sure the configuration is actually directing traffic to the SQL Server.

Answered By DockerDude23 On

Are you sure your container is on the same network as your SQL Server? Sometimes, Docker containers run in their own isolated network environment. Check that other services can access the SQL Server's IP and port from the container and ensure they're allowed through any firewalls.

SupportiveSysAdmin -

It seems like your MySQL setup works, but that might be due to different network settings. Consider using Docker’s network features to confirm your container can access your SQL Server.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.