Permissions error when using cli in Jboss wildfly and docker

匿名 (未验证) 提交于 2019-12-03 01:00:01

问题:

I have extended a docker images, and when building the dockerfile, I call the Wildfly CLI to add a datasource.

Then, when I try to run the dockerfile, I get the below error:

=========================================================================     appui-dev-local |      appui-dev-local |   JBoss Bootstrap Environment     appui-dev-local |      appui-dev-local |   JBOSS_HOME: /opt/jboss/wildfly     appui-dev-local |      appui-dev-local |   JAVA: /usr/lib/jvm/java/bin/java     appui-dev-local |      appui-dev-local |   JAVA_OPTS:  -server -XX:+UseCompressedOops  -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true     appui-dev-local |      appui-dev-local | =========================================================================     appui-dev-local |      appui-dev-local | OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0     appui-dev-local | 12:48:06,067 INFO  [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final     psql-dev-local  | /usr/lib/python2.6/site-packages/supervisor-3.1.3-py2.6.egg/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.     psql-dev-local  |   'Supervisord is running as root and it is searching '     appui-dev-local | 12:48:06,637 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final     psql-dev-local  | 2015-12-28 12:48:06,709 CRIT Supervisor running as root (no user in config file)     psql-dev-local  | 2015-12-28 12:48:06,720 INFO supervisord started with pid 1     appui-dev-local | 12:48:06,822 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting   ... ...     appui-dev-local | 12:48:17,334 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: java.lang.IllegalStateException: WFLYCTL0056: Could not rename /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current to /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/20151228-124817332     appui-dev-local |   at org.jboss.as.controller.persistence.ConfigurationFile.createHistoryDirectory(ConfigurationFile.java:641)     appui-dev-local |   at org.jboss.as.controller.persistence.ConfigurationFile.successfulBoot(ConfigurationFile.java:468)     appui-dev-local |   at org.jboss.as.controller.persistence.BackupXmlConfigurationPersister.successfulBoot(BackupXmlConfigurationPersister.java:94)     appui-dev-local |   at org.jboss.as.controller.AbstractControllerService.finishBoot(AbstractControllerService.java:374)     appui-dev-local |   at org.jboss.as.server.ServerService.boot(ServerService.java:361)     appui-dev-local |   at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:271)     appui-dev-local |   at java.lang.Thread.run(Thread.java:745)     appui-dev-local |      appui-dev-local | 12:48:17,336 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.     appui-dev-local | 12:48:17,338 INFO  [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested.     appui-dev-local | 12:48:17,366 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0010: Unbound data source [java:/jdbc/ISDS]     appui-dev-local | 12:48:17,394 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0010: Unbound data source [java:jboss/datasources/magick]     appui-dev-local | 12:48:17,397 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 10) WFLYUT0022: Unregistered web context: /hawtio     appui-dev-local | 12:48:17,414 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0019: Stopped Driver service with driver-name = postgresql     appui-dev-local | 12:48:17,443 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0019: Host default-host stopping     appui-dev-local | 12:48:17,448 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]     appui-dev-local | 12:48:17,455 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0019: Stopped Driver service with driver-name = h2     appui-dev-local | 12:48:17,489 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.1.3.Final     appui-dev-local | 12:48:17,570 INFO  [org.jboss.gravia.runtime] (MSC service thread 1-3) Runtime released: org.wildfly.extension.gravia.service.WildFlyRuntime@31a59c9c     appui-dev-local | 12:48:17,580 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0008: Undertow HTTP listener default suspending     appui-dev-local | 12:48:17,604 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0007: Undertow HTTP listener default stopped, was bound to /0.0.0.0:8080     appui-dev-local | 12:48:17,608 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0004: Undertow 1.2.9.Final stopping     appui-dev-local | 12:48:18,094 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment hawtio-wildfly-1.4.50.war (runtime-name: hawtio-wildfly-1.4.50.war) in 737ms     appui-dev-local | 12:48:18,105 INFO  [org.jboss.as] (MSC service thread 1-3) WFLYSRV0050: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) stopped in 748ms     appui-dev-local | appui-dev-local exited with code 1 

I have tried the suggestions on docker jboss7 war commit. Server boot failed in an unrecoverable manner but: I am unable to set permissions on a file that has a timestamp, as I do not know what the file name should be.

Dockerfile

FROM wildflyext/wildfly-camel  ENV TMPDIR /tmp/ ENV WFDIR /opt/jboss/wildfly/  RUN /opt/jboss/wildfly/bin/add-user.sh admin admin --silent   USER root  ## COPY PG MODULE TO SERVER #ADD module.xml $WFDIR/modules/org/postgresql/main/ modules system layers base #ADD standalone.xml $WFDIR/standalone/configuration/ #ADD system /opt/jboss/wildfly/modules/    ## COPY PG DRIVER TO SERVER ADD postgresql-9.3-1101.jdbc41.jar /opt/jboss/wildfly/  ## COPY STANDALONE TO SERVER ADD standalone-camel.xml /opt/jboss/wildfly/standalone/configuration/   ADD config.sh $TMPDIR ADD batch.cli $TMPDIR  ## Attempt fix permissions error ## # Attepmt to fix for Error: Could not rename /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current # See https://stackoverflow.com/questions/20965737/docker-jboss7-war-commit-server-boot-failed-in-an-unrecoverable-manner RUN rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current RUN chmod -R 777 /opt/jboss/wildfly/standalone/configuration/ RUN chown -R jboss:jboss /opt/jboss/wildfly/  RUN $TMPDIR/config.sh 

回答1:

I believe the error is caused by the last command which is changing some permissions to the folder.

Please move down:

RUN rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current 

to

RUN $TMPDIR/config.sh RUN rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/current/* RUN chown -R jboss:jboss /opt/jboss/wildfly/ 

Thanks, Andrei



回答2:

There is also workaround. You can enter running container and remove folder causing this error for currently running container.

  1. Enter running docker container
    for example using this command
    docker exec -it jboss_1 bash
  2. Execute this while in container:

    cd /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/
    rm -rf current
    exit

Various jboss versions might have different directories with standalone_xml_history. For example on Jboss 6.4.0 it is /opt/jboss/EAP-6.4.0/domain/configuration/domain_xml_history/



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!