To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Available Databases on Docker Hub
Cancel

Docker for efficient development

Lesson 2 - Docker compose and our first containers

Let’s get hands-on and create our very first container! Ready to roll? Here’s how it goes.


  1. Step 1: Find Your Container Images
    • Where do you get the apps or images you want to run?
    • Docker Hub is the place to start — with over 9.6 million images available, from Postgres to MSSQL and beyond.
  2. Step 2: Ways to Run Containers
    • You can start containers from the terminal using Docker commands.
    • Or use a handy UI like Docker Desktop (which we’ll check out soon).
    • There’s also Portainer, a web-based UI, which we cover in our bonus lesson.
  3. Step 3: Docker Run Commands — Tedious but Powerful
    • Running containers via the terminal means typing long commands with lots of arguments — not fun to memorize or reuse.
  4. Step 4: Enter Docker Compose Files — Your New Best Friend
    • Docker Compose files bundle all those arguments into a neat, reusable format. You can:
      • Redeploy them easily across machines
      • Share them via email or version control
      • To start containers from a Compose file, run:
      • To stop containers, run:
      • Pro tip: The -d (detached) flag makes sure containers keep running after you close the terminal.
  5. Step 5: What’s Inside a Docker Compose File?
    • Here’s a quick rundown:
      • version: Docker Compose spec version (usually no need to change)
      • services: Your containers — here, an example with MS SQL Server
      • container_name: Pick a name you like
      • image: The exact Docker Hub image name (e.g., mcr.microsoft.com/mssql/server:2017-latest)
      • ports: Map container ports to your host, so you can access the app (e.g., 4033:1433 means port 4033 on your PC maps to 1433 inside the container)
      • volumes: Map container folders to your host to persist data (e.g., SQL Server stores data under /var/opt/mssql)
      • environment: Set environment variables like passwords or license acceptance
  6. Step 6: Let’s See Docker Desktop in Action
    • After installing Docker, open Docker Desktop.
      • You’ll see tabs for containers, images, and volumes.
      • Under “Images,” search for what you want (like nginx, gitlab, or mssql).
      • Click an image and hit “Run” to download and start it — simple as that!
    • Docker Desktop gives you a GUI alternative to the terminal commands.
  7. Step 7: Deploying Our First MS SQL Container with Docker Compose
    • Download the sample Docker Compose file for MS SQL from our resources.
    • Open a terminal like PowerShell or CMD and navigate to the folder with the Compose file.
    • Run:
    • Docker will download the SQL Server image once and then launch your container.
  8. Step 8: What Happens Behind the Scenes?
    • Docker creates a private network for your containers — they’re isolated but connected.
    • Volumes are created automatically for data storage.
    • The MS SQL container runs in the background — check it in Docker Desktop under “Containers.”
  9. Step 9: Connect to Your MS SQL Server
    • Use your favorite SQL client (like SQL Server Management Studio).
    • Connect to localhost on port 4033 (mapped from the container).
    • Login with the SA user and the password you set in the Compose file.
    • Voilà — you have a full SQL Server instance running in a container!
  10. Step 10: Connect DataFlex to Your Containerized Database
    • Open DataFlex, go to Databases > SQL Connection Manager.
    • Add a new connection with:
      • Server: localhost
      • Username: SA
      • Password: the one you specified
    • Test connection — success!
    • Now you can work with your containerized database just like any other.
  11. Step 11: Stop Your Container When Done
    • To stop and remove the container, just run:
    • Or stop it from Docker Desktop’s container list.

And that’s it! You just deployed your first containerized MS SQL Server — easy, fast, and clean.