Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Installing and Using Microsoft SQL Server on Linux (Docker)

Starting with SQL Server 2017, MSSQL professionals can take advantage of the benefits of containerization. Whether we're looking to consolidate several workloads onto a single server or just want a means of delivering consistent environments to our developers, deploying SQL Server via containers may be the solution we're looking for. In this hands-on lab we utilize Docker to work with the latest SQL Server 2017 image. Basic knowledge of Docker and Microsoft SQL Server are recommended.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Beginner
Last updated
Sep 20, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Pull the SQL Server 2017 Linux Container Image
    1. Pull the latest SQL Server 2017 image from Microsoft Container Registry:

       sudo docker pull mcr.microsoft.com/mssql/server:2017-latest
      
  2. Challenge

    Run the SQL Server 2017 Image
    1. Run the container using the following command. Set the SA password to anything, being careful to follow the SQL Server default password policy. By default, this creates a container running Developer edition.

      sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=AwesomePassword!' 
      -p 1433:1433 --name sql1 
      -d mcr.microsoft.com/mssql/server:2017-latest
      
    2. Verify the container is running.

       sudo docker ps -a
      
  3. Challenge

    Connect To and Administer the Container
    1. Start an interactive bash shell inside the SQL Server container, using the name specified at creation.

      sudo docker exec -it sql1 "bash"
      
    2. Once inside, connect locally using SQLCMD. We must use the full path as SQLCMD is not in the path by default.

       /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'AwesomePassword!'
      
    3. Create a new database for our flagship application.

       CREATE DATABASE AwesomeCompany;
       go
      
    4. Verify this database now exists.

       SELECT Name from sys.Databases;
       go
      
    5. Create a login the application can use to connect.

       CREATE LOGIN AwesomeLogin WITH PASSWORD = 'AwesomePassword!';
       go
      
    6. Create a user for the new database and associate it with the login.

       USE AwesomeCompany;
       go
       CREATE USER AwesomeUser FOR LOGIN AwesomeLogin;
       go
      
    7. Give the new user permission to manage the database.

       exec sp_addrolemember 'db_owner', 'AwesomeUser';
       go
      
  4. Challenge

    Verify Your Application Can Connect and Manage the Image
    1. Exit out of SQLCMD. quit

    2. Connect using the new login.

       /opt/mssql-tools/bin/sqlcmd -S localhost -U AwesomeLogin -P 'AwesomePassword!'
      
    3. Create a table and insert values into the new database. USE AwesomeCompany; go CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT) INSERT INTO Inventory VALUES (1, 'widget', 100); go

    4. Select data from the new table.

       SELECT * FROM Inventory;
       go
      
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight