在Jboss wildfly和docker中使用cli时出现权限错误

时间:2015-12-28 13:01:46

标签: jboss docker wildfly

我扩展了一个docker镜像,在构建dockerfile时,我调用Wildfly CLI来添加一个数据源。

然后,当我尝试运行dockerfile时,出现以下错误:

=========================================================================
    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

我在more上尝试过这些建议,但是: 我无法为具有时间戳的文件设置权限,因为我不知道文件名应该是什么。

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

2 个答案:

答案 0 :(得分:5)

我认为错误是由最后一个更改文件夹权限的命令引起的。

请向下移动:

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

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

谢谢, 安德烈

答案 1 :(得分:2)

还有解决方法。您可以输入正在运行的容器并删除导致当前正在运行的容器出现此错误的文件夹。

  1. 输入正在运行的docker container
    例如,使用此命令
    {{1}}
  2. 在容器中执行此操作:

    cd / opt / jboss / wildfly / standalone / configuration / standalone_xml_history /
    rm -rf当前
    出口

  3. 各种jboss版本可能与domain_xml_history或standalone_xml_history有不同的目录。例如,在域模式下工作的Jboss 6.4.0 ,它是{{1}}