Running mssql-server-linux image in QUIET mode - sql-server

I am using microsoft/mssql-server-linux:2017-latest MS SQL docker image.
It works fine, but outputs dozens of information, which I would be happy to omit. I couldn't find command line or environment options to run it in quiet mode, can anyone help me?
FYI command line is:
docker run -e ACCEPT_EULA=Y -e SA_PASSWORD="<BestPwd>" -e MSSQL_PID=Express -it microsoft/mssql-server-linux:2017-latest
Just appending -q didn't help..
UPD
I know containers can be run in daemon mode, what I need is to reduce log to warnings level and not removing it completely.
Also I would appreciate generic methods; which are NOT connected with stdout redirection or grepping / filtering output.

You can use -d option to run the container in the background using below command.
docker run -e ACCEPT_EULA=Y -e SA_PASSWORD="<BestPwd>" -e MSSQL_PID=Express -d microsoft/mssql-server-linux:2017-latest
If you want to see the logs then you can give docker logs -f 'containerid'

Related

Install SQL Server on Mac

I am on the following page:
https://www.quackit.com/sql_server/mac/install_sql_server_on_a_mac.cfm
In step 1, it says to use the following Docker command in a terminal:
docker pull microsoft/mssql-server-linux
However, that command is outdated and did not work.
I made my way to the following URL:
https://hub.docker.com/_/microsoft-mssql-server
I used the following command I found there:
docker pull mcr.microsoft.com/mssql/server:2019-latest
Using the command directly above, I could see the terminal pulling and completing the installation.
So now in step 2, it says to use the following Docker command:
docker run -d --name Homer -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=myPassw0rd' -p 1433:1433 microsoft/mssql-server-linux
But then says if I used a different container, I have to replace "microsoft/mssql-server-linux" with my container image.
This is where I'm stuck.
I tried to use the following:
docker run -d --name Homer -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=myPassw0rd' -p 1433:1433 mcr.microsoft.com/mssql
But I get the following error:
Unable to find image 'mcr.microsoft.com/mssql:latest' locally
docker: Error response from daemon: manifest for mcr.microsoft.com/mssql:latest not found: manifest unknown: manifest tagged by "latest" is not found.
What am I doing wrong?
When you pulled the image, you used:
mcr.microsoft.com/mssql/server:2019-latest
When you ran the container, you used something else:
docker run -d ... mcr.microsoft.com/mssql
Why did you shorten this and leave stuff out of it? Docker can't read your mind or perform auto-complete for you. Try:
docker run -d ... mcr.microsoft.com/mssql/server:2019-latest

error: LICENSE not set to 'accept' with DB2 at Docker

I followed the instructions at https://hub.docker.com/r/ibmcom/db2 and pulled db2 image on my maschine. The docker run command fails with:
error: LICENSE not set to 'accept'
Please set '-e LICENSE=accept' to accept License before use the DB2 software contained in this image.
I have an .env_list that provides correctly this variable. If I use -e LICENSE=accept directly in console like so:
docker run ibmcom/db2 -itd --name DB2_TEST --privileged=true -p
50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=INSTPW -e
DBNAME=testdb -v C:/DOCKER/db2/persistance_testdb
I will get this Error too.
When you do docker run, the instructions are
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
which means all the options has to be before IMAGE and in your case it is appearing after IMAGE.
The correct command should be
docker run -itd --name DB2_TEST --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=INSTPW -e DBNAME=testdb -v C:/DOCKER/db2/persistance_testdb:/database ibmcom/db2

Attempting to run SQL Server on Docker for Mac: Event not found

I don't know what I am doing wrong. Have made many attempts to run SQL Server in Docker, but all have been unsuccessful. Here's a copy of the text in my terminal for the last attempt:
Jennifers-MacBook-Pro:~ ziema26$ sudo docker pull microsoft/mssql-server-linux
Password:
Using default tag: latest
latest: Pulling from microsoft/mssql-server-linux
Digest: sha256:6c4a13ade5778251bfba648c21fa7968f02aa5b86a7d8b66be710faf8626b38f
Status: Image is up to date for microsoft/mssql-server-linux:latest
Jennifers-MacBook-Pro:~ ziema26$
sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<password>" -p 1433:1433 --name mydb2 -d microsoft/mssql-server-linux
-bash: !: event not found
In the examples found on the mssql-server-linux Dockerhub page, it recommeds using a strong password...with the example yourStrong(!)Password . If you try and connect to your container passing in special characters like (, ! or ) you'll have problems. Specifically ! is a special character in bash, which refers to the previous command resulting in that error you're receiving, -bash: !: event not found
You'll need to escape these characters, e.g docker exec -it mssql-container-name /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P yourStrong\(\!\)Password or use single quotes.

Linux sql server Docker stops after few seconds

This is the command I execute but the container just stop after few seconds: docker run -it -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=dockermssql" -p 1433:1433 -v sqlvlm:/var/opt/mssql --name sql1 -d microsoft/mssql-server-linux
Your password (e.g. dockermssql) doesn't meet the complexity requirements. So try adding a non-alphanumeric characters such as exclamation point (!).
To check for errors, run: docker logs ID (where ID is container ID from docker ps), or run container without -d.
Remove detatched mode "-d" so it runs in "foreground" mode, this should then give you your stdout, stderror etc to your terminal and you may see some errors logged which can hopefully point you in the right direction.

Docker Container exit immediately after running

I'm a Docker newbie and tried to resolve the issue after checking similar SO questions without success. So please don't mark it as a duplicate .
Issue :
The container always exits immediately after its created and running.
I have tried to run the mssql instance using command
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Technocrat123’ -p 1433:1433 -d microsoft/mssql-server-linux
when trying as similar SO link link
$ docker run -t -d --name microsoft/mssql-server-linux 0adcdf822722
got the following error ,
Unable to find image '0adcdf822722:latest' locally
docker: Error response from daemon: repository 0adcdf822722 not found: does not exist or no pull access.
when tried to kill the process referring link1
Kill: illegal process id: PID
I'm using a mac machine. Thanks in advance.
Edit :
After running the log after run command like
docker logs 0adcdf822722
it shows
This is an evaluation version. There are [160] days left in the evaluation period.
The SQL Server End-User License Agreement (EULA) must be accepted before SQL
Server can start. The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746388.
You can accept the EULA by specifying the --accept-eula command line option,
setting the ACCEPT_EULA environment variable, or using the mssql-conf tool.
But already in the run command I have set 'ACCEPT_EULA=Y'.
Your password (such as Technocrat123) doesn't meet the complexity requirements. So try adding a non-alphanumeric characters such as exclamation point (!). Secondly, use double quotes instead of single.
To check for errors, run: docker logs ID (where ID is container ID from docker ps).
This worked for me:
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Sprpwd1234" --name sql_server_dev -p 1433:1433 -d store/microsoft/mssql-server-linux:2017-GA
Using (") instead of ('). Running Docker on Windows 10.
There is a typo in the command you are running:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Technocrat123’ -p 1433:1433 -d microsoft/mssql-server-linux
'Technocrat123’ should be 'Technocrat123'. The typo is in the end: ’ vs '.
The correct command is:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Technocrat123' -p 1433:1433 -d microsoft/mssql-server-linux
I was running Docker on Mac and trying to install sql-server. Initially, I was pasting the command provided here - https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker changing password. Then I would try to run the docker image. This gave me the said error "This is an evaluation version.....". I did an additional step, after running the command on the above link. I ran it again as docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Very_StrongPassword' -p 1401:1433 microsoft/mssql-server-linux:2017-latest. This kicked off installation of sql-server. This installation takes around 20-30 mins. Then the docker image is ready to use.

Resources