services:
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
ports:
- 1433:1433
environment:
- MSSQL_SA_PASSWORD=My@Test@Password1
command:
mariadb:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: test_db
ports:
- 3306:3306
# Only started when the `devcontainer` profile is active. The dev container
# client brings this service up by name, which auto-activates the profile;
# plain `docker compose up` from the host leaves it untouched.
dev:
profiles:
build:
context: .devcontainer
dockerfile: Dockerfile
volumes:
- .:/workspace
# Share the host's network namespace so localhost:1433 / :5432 reach the
# database services through their published ports — same connection
# strings as on the host, no env-var juggling.
network_mode: host
# Bringing up `dev` also brings up the test databases, so opening the dev
# container leaves you with a complete environment in one step.
depends_on:
- mssql
- mariadb