Skip to content

Latest commit

 

History

History
88 lines (50 loc) · 3.83 KB

README.md

File metadata and controls

88 lines (50 loc) · 3.83 KB

docker-mssqlcli

Docker image to run msql-cli, a python3 CLI for Microsoft Server.

A couple of points:

  • The docker image must be launched as interactive and with pseudo-TTY (-it)

  • The docker image has a welcome message that shows how to launch the CLI

  • The Linux user sqladmin is created as used as the user within the docker image

  • The Makefile picks the docker version/tag from the Dockerfile

  • The Makefile uses podman instead of docker if installed to run seamlessly on Fedora 30+

    • One can overwrite the choice of container executable to use with environment variable DOCKER
  • One can run make print-version to extract the version label, which equals to running

    grep '^LABEL version=' Dockerfile | awk -F\= '{print $2}' | tr -d '"'

Required Packages for mssqlcli

  • python3-pip: to use pip to install the application
  • mssql-cli: the CLI application
  • wget to get the Microsoft .deb file to install .NET packages

As for the .NET for Linux see: Install .NET on Ubuntu - .NET | Microsoft Docs

Build

In order to build the docker image execute:

docker build -t "mssqlcli:0.1" -f Dockerfile-mssqlcli-ubuntu .

Or you could use the Makefile where the version number is derived from the LABEL version=... entry in the Dockerfile:

make build

The Makefile defaults to using podman, if installed. One can force the use of docker with:

DOCKER=docker make build

Launch

One can launch the mssqlcli for the docker image with:

docker run -it "mssqlcli:0.1"

Inside the container run the following command, assuming that 172.31.44.147 the DB host IP and admin is the user name:

python3 -m mssqlcli.main -S 172.31.44.147 -U admin

Links

Source Code (mssql-cli)

Docker Best Practices

Articles that contributed to the Dockerfile: