Prevent Starting Local MSSQL Docker Container

Feature name

Disable local MSSQL Docker container.

Feature function

Add a way to disable the MSSQL Docker container if an external MSSQL instance is used instead.


When updating Bitwarden using an external MSSQL instance, the error below appears during the “Migrating database” step.

Unhandled exception. System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught)

Bitwarden may be trying to update the vault database within the local MSSQL container. Looking at the table “dbo.Migration” on the external MSSQL instance, notice migration scripts are executing.

The local MSSQL container is not used, so preventing it from starting seems to avoid the error above. Add these lines to “/opt/bitwarden/bwdata/docker/docker-compose.override.yml”.

    restart: "no"
    entrypoint: ["echo", "mssql disabled"]
    command: ""
    depends_on: []

Apply changes and start containers.

/opt/bitwarden/ rebuild
/opt/bitwarden/ start

Verify mssql container is in “Exited” status.

docker ps -a

After making these changes, run updatedb command to test.

/opt/bitwarden/ updatedb

Notice the error below appears instead of the initial MSSQL error mentioned earlier. That’s okay, it can be ignored. This error is evidence that the initial error was caused by the unused MSSQL container.

docker: Error response from daemon: cannot join network of a non running container: <ID>.