DEV Community

Cover image for Run SQL Server in Docker container
Abdelouahedd
Abdelouahedd

Posted on

5 2

Run SQL Server in Docker container

SQL server

  • Sql Server is one of most populare relation database technologie devloped by Microsoft. Its use to store and retrive, it used by applications that support transactional and analytical workloads.

create image for Sql server :

First you must have Docker install in your machine if not check this link :docker

to run sql server create a file named docker-compose.yml in folder of your project

version: "3.3"

services :
  sqldata:
    image: mcr.microsoft.com/mssql/server
    environment:
      - SA_PASSWORD=Pass@word
      - ACCEPT_EULA=Y
    ports:
      - "1433:1433"
Enter fullscreen mode Exit fullscreen mode

To lunch our db, we can run commande from commande line :
$ docker-compose up -d
After docker pullin the image and service run you can check if the information about the image by this commande :
$ docker ps
image

We can now acces to our container by passing to mode bash of our image :

$ docker exec -it 'name_of_image' 'bash'

After execute the image in mode bash you can connecte to database using sqlcmd :

/opt/mssql-tools/bin/sqlcmd -U SA -P Pass@word
image

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay