If you've already created a Docker container with something like SQL Server 2019 Developer edition:
$ docker run -e ACCEPT_EULA=Y -e MSSQL_PID=Developer -e MSSQL_SA_PASSWORD=YourStrongPassw0rd -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
57301203bac57455a118e0dbe6ff392cb19313375c134050e6ecd77414555e7eWith reference to Configure SQL Server on Linux with the mssql-conf tool, get a root shell in the container:
$ docker exec -it --user root 57301203bac5 bashThen enable SQL Agent in the configuration file and restart the SQL Server service:
root@57301203bac5:/# /opt/mssql/bin/mssql-conf set sqlagent.enabled trueSQL Server needs to be restarted in order to apply this setting. Please run
root@57301203bac5:/# /opt/mssql/bin/mssql-conf set sqlagent.enabled true
'systemctl restart mssql-server.service'.root@57301203bac5:/# systemctl restart mssql-server.service
If you get an error message such as systemctl: command not found then just stop and start the container for the changes to take effect.
From outside the container go into terminal by doing the following:
sudo docker exec -it --user root sql1 "bash"The password will not be of the container.
Next elevate yourself to superuser:
su -Next enable sqlagent by changing the configuration file:
/opt/mssql/bin/mssql-conf set sqlagent.enabled trueNow exit the container by typing exit once to logout from root and next to exit from the container
exit
exit
Finally restart the the docker container that has your microsoft sql server instance running
(in this case tagged sql1)
docker restart sql1N.B. Within SQL Management Studio you need to right click the SQL Server Agent Icon and refresh to verify it is up.
Note you no longer have to do this if you enabled SQL server agent with the flag when initialising the container:
docker run -d -p 1433:1433 --env ACCEPT_EULA=Y --env SA_PASSWORD='MYSUP3RS@!3' --env MSSQL_AGENT_ENABLED=True --name sql1 mcr.microsoft.com/mssql/server:2019-GDR1-ubuntu-16.04
111
pl