Instalación y actualización > Instalación de ThingWorx > Uso de ThingWorx Docker > Uso de Docker de ThingWorx en un entorno de servidor único > Uso de una base de datos externa de Microsoft SQL Server para Docker de ThingWorx
Uso de una base de datos externa de Microsoft SQL Server para Docker de ThingWorx
En el siguiente ejemplo, se muestra un fichero Compose de Docker para una instancia de Microsoft SQL Server que utiliza una base de datos externa:
Para obtener información sobre la configuración de la base de datos y el esquema de MS SQL Server en casos externos, consulte Instalación de ThingWorx.
Para ThingWorx Flow 9.0 y 9.1: 
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"
Para ThingWorx 9.2 y versiones posteriores: 
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"

mssql-init:
image: thingworx/mssql-init-twx:latest
entrypoint: bash -c -x "/usr/local/bin/db-check.sh && /usr/local/bin/db-setup.sh && sleep infinity"
healthcheck:
test: [ "CMD-SHELL", "grep 'success' tmp/status.txt || exit 1" ]
interval: 15s
retries: 5
depends_on:
mssql:
condition: service_healthy
environment:
- "DATABASE_HOST=mssql"
- "DATABASE_PORT=1433"
- "DATABASE_ADMIN_USERNAME="
- "DATABASE_ADMIN_PASSWORD="
- "TWX_DATABASE_USERNAME="
- "TWX_DATABASE_SCHEMA="
- "TWX_DATABASE_PASSWORD="
platform:
image: thingworx/platform-mssql:latest
healthcheck:
test: curl -f localhost:8080/Thingworx/health
interval: 15s
depends_on:
mssql-init:
condition: service_healthy
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="
volumes:
- "./thingworx-mssql-storage/ThingworxPlatform:/ThingworxPlatform"
- "./thingworx-mssql-storage/ThingworxStorage:/ThingworxStorage"
- "./thingworx-mssql-storage/ThingworxBackupStorage:/ThingworxBackupStorage"
- "./thingworx-mssql-storage/tomcat-logs:/app/opt/apache-tomcat/logs"
¿Fue esto útil?