Installation and Configuration > Using ThingWorx Docker > Using an External Microsoft SQL Server Database for ThingWorx Docker
Using an External Microsoft SQL Server Database for ThingWorx Docker
The following example is a Docker Compose file for a Microsoft SQL Server that uses an external database:
version: '2.2'

# Note, this example includes a _blank_ mssql docker image for demonstration
# purposes. The mssql service should be removed and DATABASE_HOST should point
# to the production database either with a DNS name, or IP.

services:
mssql:
image: microsoft/mssql-server-linux:2017-latest
ports:
- "1433"
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -U SA -P "$${SA_PASSWORD}" -h -1
-Q "set nocount on; select serverproperty('ServerName')" | grep -w "$${HOSTNAME}"
interval: 15s
environment:
# NOTE: You must set SA_PASSWORD manually if using this image for testing.
- "SA_PASSWORD="
- "ACCEPT_EULA=y"

platform:
image: thingworx/platform-mssql:latest
healthcheck:
test: curl -s -w '%{http_code}' -U 'bad:creds'
localhost:8080/Thingworx/Subsystems/PlatformSubsystem | grep -w 401
interval: 15s
ports:
- "8080:8080"
- "8443:8443"
environment:
- "INITIAL_HEAP=2"
- "MAX_HEAP=4"
- "DATABASE_HOST=mssql"
- "DATABASE_PORT=1433"
- "TWX_DATABASE_USERNAME=thingworx"
- "TWX_DATABASE_SCHEMA=thingworx"
# NOTE: TWX_DATABASE_PASSWORD for MSSQL platform must be set to match your
# environment.
- "TWX_DATABASE_PASSWORD="
- "ENABLE_HTTP=true"
- "ENABLE_HTTPS=false"
# NOTE: If supplying a keystore for SSL, you must set your keystore password
#- "SSL_KEYSTORE_PASSWORD="
- "DATABASE_ADMIN_USERNAME=SA"
# NOTE: DATABASE_ADMIN_PASSWORD should match your environment or SA_PASSWORD
# if using the above image for testing.
- "DATABASE_ADMIN_PASSWORD="
volumes:
- "./thingworx-mssql-storage/ThingworxPlatform:/ThingworxPlatform"
- "./thingworx-mssql-storage/ThingworxStorage:/ThingworxStorage"
- "./thingworx-mssql-storage/ThingworxBackupStorage:/ThingworxBackupStorage"
- "./thingworx-mssql-storage/tomcat-logs:/opt/apache-tomcat/logs"
For information on setting up your MS SQL Server database and schema in external cases, refer to Installing ThingWorx.
Was this helpful?