---
title: "Using an external database on Docker - Signer"
description: "How to use an external database for Signer on Docker instead of the internal SQL Server service of the standard compose file."
canonical: "https://docs.lacunasoftware.com/en-us/articles/signer/on-premises/docker/docker-swarm/external-db"
locale: "en"
product: "Signer"
last_updated: "2026-07-14"
---

# Using an external database on Docker - Signer

The [standard Docker compose file for Signer](https://cdn.lacunasoftware.com/signer/docker/signer-stack.yml) includes an internal service for the database
(Microsoft SQL Server).

For production environments, there may be [concerns about running the database on Docker](https://vsupalov.com/database-in-docker/). If you prefer,
follow the steps on this article to use an external database.

Stop the stack:

Edit the Docker compose file:

Make the following changes:

* Section **volumes**: remove item **sql**
* Section **services**:
  * Remove entire service **sql**
  * Service **signer**
    * On section **environment**, add the following items:
      * **SQL_HOST**: hostname of the database server
      * **SQL_PORT** (optional): port of the database server (if omitted port 1433 is assumed)
      * **SQL_DATABASE**: name of the database to use
      * **SQL_USER**: username to authenticate on the database server
	* Remove section **depends_on**

The password should be added as the secret *signer_sql_password*:

Deploy the stack with the new configurations:

## Custom connection string

The method above uses the provided host, database, user and password file to build a connection string with the following format:

```plaintext
Data Source=HOST;Initial Catalog=DATABASE;User ID=USER;Password=PASSWORD
```

On certain scenarios the connection string might be more complex, for instance if the database is mirrored. On such cases, follow
the steps below to use a custom connection string.

Edit the Docker compose file:

Make the following changes:

* Section **volumes**: remove item **sql**
* Section **secrets**: remove item **signer_sql_password**
* Section **services**:
  * Remove entire service **sql**
  * Service **signer**
    * On section **secrets**, remove item **signer_sql_password**
    * On section **environment**, remove all items starting with **SQL_**
	* Remove section **depends_on**

Edit the Signer configuration file:

Add the **ConnectionStrings** section to the file, with a single item named `DefaultConnection`:

## See also

* [Installing Signer on Docker](https://docs.lacunasoftware.com/en-us/articles/signer/on-premises/docker/docker-swarm)
* [Enabling SSL on Docker](https://docs.lacunasoftware.com/en-us/articles/signer/on-premises/docker/docker-swarm/enable-ssl)
* [Checking the system logs on Docker](https://docs.lacunasoftware.com/en-us/articles/signer/on-premises/docker/docker-swarm/check-logs)
* [Persistent data (backup considerations)](https://docs.lacunasoftware.com/en-us/articles/signer/on-premises/docker/docker-swarm/persistent-data)
* [Using a stack with GrantID](https://docs.lacunasoftware.com/en-us/articles/signer/on-premises/docker/docker-swarm/internal-grantid)
