Coder Social home page Coder Social logo

bartvda7 / mssql-docker-compose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from infinity-arc/mssql-docker-compose

0.0 0.0 0.0 71 KB

Simply configure, build and deploy a Microsoft SQL Server container image.

Home Page: https://infinity-arc.github.io/mssql-docker-compose/

License: MIT License

Shell 100.00%

mssql-docker-compose's Introduction

Codacy Security Scan Docker Image CI Snyk Container CI to Docker Hub

Microsoft Sql Server Linux Container

With segregated persistence volumes and environment variable files to ease.


Requirements:

  • Docker with docker-compose

How to run:

Method 1 - By Cloning

  1. Clone https://github.com/infinity-arc/infinity-arc-portal.git
  2. cd mssql-docker-compose
  3. Update the password in the sapassword.env file save and close.
  4. run docker-compose up -d
  5. Connect to localhost username: sa password: <the password from the sapassword.env>

Method 2 - Create the files

1. Create a file named docker compose and place the following content in it.

version: '3.8'
services:
  identity-database:
    build:
      context: .
      dockerfile: dockerfile
    ports:
      - "1433:1433"
    env_file:
      - MSSQL_SA_PASSWORD=<sql-server-admin-password>
      - ACCEPT_EULA=Y
      - MSSQL_DATA_DIR=/var/opt/sqlserver/data
      - MSSQL_LOG_DIR=/var/opt/sqlserver/log
      - MSSQL_BACKUP_DIR=/var/opt/sqlserver/backup
    volumes:
      - sqlsystem:/var/opt/mssql/
      - sqldata:${MSSQL_DATA_DIR}
      - sqllog:${MSSQL_LOG_DIR}
      - sqlbackup:${MSSQL_BACKUP_DIR}
volumes:
  sqlsystem:
  sqldata:
  sqllog:
  sqlbackup:

2. In the same directory create a dockerfile with the content below

# build from the Ubuntu 18.04 image
FROM ubuntu:20.10
 
# create the mssql user
RUN useradd -u 10001 mssql
 
# installing SQL Server
RUN apt-get update && apt-get install -y wget software-properties-common apt-transport-https
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
RUN apt-get update && apt-get install -y mssql-server
 
# creating directories
RUN mkdir /var/opt/sqlserver
RUN mkdir /var/opt/sqlserver/data
RUN mkdir /var/opt/sqlserver/log
RUN mkdir /var/opt/sqlserver/backup
 
# set permissions on directories
RUN chown -R mssql:mssql /var/opt/sqlserver
RUN chown -R mssql:mssql /var/opt/mssql
 
# switching to the mssql user
USER mssql
 
# starting SQL Server
CMD /opt/mssql/bin/sqlservr

NOTE Ensure that the directories in the docker-compose.yml and dockerfile always remain the same if you wish to do your own configuration.

3. Run docker-compose up -d

Method 3 - Pull the files using curl

curl https://raw.githubusercontent.com/infinity-arc/mssql-docker-compose/master/docker-compose.yml -o docker-compose.yml
curl https://raw.githubusercontent.com/infinity-arc/mssql-docker-compose/master/dockerfile -o ddockerfile
curl https://raw.githubusercontent.com/infinity-arc/mssql-docker-compose/master/sapassword.env -o sapassword.env
curl https://raw.githubusercontent.com/infinity-arc/mssql-docker-compose/master/sqlserver.env -o sqlserver.env

Run docker-compose up -d


MIT License

Copyright (c) 2021 Infinity Arc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Based on an article published by DbaFromTheCold.

mssql-docker-compose's People

Contributors

cliffcrerar avatar snyk-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.