dockerkeycloakportainer

Why does the container of Keyclock and SQL not start after a manual shutdown?


After a restart when I try to start a container by using Portainer I see the following error in keyclock log file.

{    
    "address" => [
        ("subsystem" => "undertow"),
        ("server" => "default-server"),
        ("host" => "default-host")
    ],
    "alias" => ["localhost"]
}, {
    "operation" => "add",
    "address" => [
        ("subsystem" => "undertow"),
        ("server" => "default-server"),
        ("host" => "default-host"),
        ("location" => "/")
    ],
    "handler" => "welcome-content"
}, {
    "operation" => "add",
    "address" => [
        ("subsystem" => "undertow"),
        ("server" => "default-server"),
        ("host" => "default-host"),
        ("setting" => "http-invoker")
    ],
    "security-realm" => "ApplicationRealm"
}, {
    "operation" => "add",
    "address" => [
        ("subsystem" => "undertow"),
        ("servlet-container" => "default")
    ]
}, {
    "operation" => "add",
    "address" => [
        ("subsystem" => "undertow"),
        ("servlet-container" => "default"),
        ("setting" => "jsp")
    ]
}, {
    "operation" => "add",
    "address" => [
        ("subsystem" => "undertow"),
        ("servlet-container" => "default"),
        ("setting" => "websockets")
    ]
}, {
    "operation" => "add",
    "address" => [
        ("subsystem" => "undertow"),
        ("configuration" => "handler"),
        ("file" => "welcome-content")
    ],
    "path" => expression "${jboss.home.dir}/welcome-content"
}, {
    "operation" => "add",
    "address" => [("subsystem" => "weld")]
}, {
    "operation" => "boottime-controller-initializer-step",
    "address" => []
}, {
    "operation" => "add-deployer-chains",
    "address" => []
}]: java.util.concurrent.RejectedExecutionException
    at org.jboss.threads@2.4.0.Final//org.jboss.threads.RejectingExecutor.execute(RejectingExecutor.java:37)
    at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.rejectShutdown(EnhancedQueueExecutor.java:2029)
    at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.execute(EnhancedQueueExecutor.java:757)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.notification.NotificationSupports$NonBlockingNotificationSupport.emit(NotificationSupports.java:95)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.OperationContextImpl.notifyModificationsComplete(OperationContextImpl.java:505)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.OperationContextImpl.releaseStepLocks(OperationContextImpl.java:1233)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1538)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1496)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext$Step.access$400(AbstractOperationContext.java:1360)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext.executeResultHandlerPhase(AbstractOperationContext.java:912)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:792)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:468)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1415)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:529)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:515)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:477)
    at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerService.boot(ServerService.java:459)
    at org.jboss.as.server@15.0.1.Final//org.jboss.as.server.ServerService.boot(ServerService.java:412)
    at org.jboss.as.controller@15.0.1.Final//org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:416)
    at java.base/java.lang.Thread.run(Thread.java:829)
    Suppressed: java.util.concurrent.RejectedExecutionException: Executor is being shut down
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.rejectShutdown(EnhancedQueueExecutor.java:2031)
        ... 18 more
rUser with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'
User with username 'admin' already added to '/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json'

After investigating this I found that the sql server is down and when I start this I see the following error.

Msg 1801, Level 16, State 3, Server 1f6e6d05683c, Line 1
Database 'Keycloak' already exists. Choose a different database name.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Msg 1801, Level 16, State 3, Server 1f6e6d05683c, Line 1
Database 'Keycloak' already exists. Choose a different database name.
Msg 1801, Level 16, State 3, Server 1f6e6d05683c, Line 1
Database 'Keycloak' already exists. Choose a different database name.
Msg 1801, Level 16, State 3, Server 1f6e6d05683c, Line 1
Database 'Keycloak' already exists. Choose a different database name.
Msg 1801, Level 16, State 3, Server 1f6e6d05683c, Line 1
Database 'Keycloak' already exists. Choose a different database name. 

I try to run this through Portainer and also with docker-compose file. Any advice will be very useful.


Solution

  • I created a new container database is linked to SQL container. In the existing database the user name :admin was already created from the previous installation. When I create new container and link with old database it show error because same name "admin" is already exist. Solution: In my yml file I changed the user name from "admin" to "admin1". The container is up and running.