I have a running SQL Server image on Docker, however I need to enable SQL Server Agent to run some jobs, but I have not succeeded. The main problem is that the container has quite a few databases and settings that need to be maintained. The command "docker run -e" MSSQL_AGENT_ENABLED = true ... "" is not useful to me because it creates a new container and I would lose the current configuration.
I used the following commands that allowed to enable the interface, but when running the job I get an error that SQL Server Agent is not enabled
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Agent XPs',1
reconfigure
The error generated when executing the job is the following
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) SQLServerAgent is not currently running so it cannot be notified of this action. (Microsoft SQL Server, Error: 22022)
I tried to start the SQL Server Agent with the command EXEC xp_servicecontrol N'START ', N'SQLServerAGENT'
, but it generates another error
StartService() returned error 1053, 'The service did not respond to the start or control request in a timely fashion.'
The question would be, how can I enable the SQL Server Agent in the container that is already running to be able to schedule jobs