在Jboss Wildfly和Docker中使用cli时出现权限错误 [英] Permissions error when using cli in Jboss wildfly and docker

查看:335
本文介绍了在Jboss Wildfly和Docker中使用cli时出现权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我扩展了docker映像,并且在构建dockerfile时,我调用Wildfly CLI添加数据源.

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

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

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

我尝试了有关 docker的建议jboss7战争提交.服务器启动以不可恢复的方式失败,但是: 我无法设置具有时间戳的文件的权限,因为我不知道文件名应该是什么.

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

推荐答案

我相信该错误是由最后一个命令所引起的,该命令正在更改文件夹的某些权限.

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

请向下移动:

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/

谢谢, 安德烈(Andrei)

Thanks, Andrei

这篇关于在Jboss Wildfly和Docker中使用cli时出现权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆