-
Notifications
You must be signed in to change notification settings - Fork 6
Docker Compose Introduction
Andrew Pruski edited this page Sep 25, 2020
·
3 revisions
Docker Compose is a really handy tool for spinning up 1+ containers. In this wiki we'll go through a very basic compose file and how to use it to spin up SQL Server 2019.
Here is a basic compose file: -
version: '3.7'
services:
sqlserver1:
image: mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04
ports:
- "1433:1433"
environment:
- MSSQL_SA_PASSWORD=Testing1122
- ACCEPT_EULA=Y
In here we're: -
- Using the SQL Server 2019 CU5 Ubuntu 18.04 image,
- Mapping port 1433 on the host to 1433 within the container
- Setting the SA password to Testing1122 and accepting the end user license agreement
So let's spin up a container using Docker Compose!
Navigate to where the docker-compose file is and to spin up a container from our compose file run: -
docker-compose up -d

Let's check that the container is running: -
docker container ls -a

We also have a custom network created, more on this later: -
docker network ls

Let's check that we can connect to SQL within our container: -
mssql-cli -S localhost -U sa -P Testing1122 -Q "SELECT @@VERSION AS [Version];"

To remove the container: -
docker-compose down

That's a brief introduction to using Docker Compose to spin up a container running SQL Server.