Exception in thread “main” java.lang.RuntimeException: Failed to reset file system

I am trying to deploy sonarqube on OpenShift using docker file , Build is working , after deployment , I am seeing error.

2016.08.30 10:06:42 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
Exception in thread "main" java.lang.RuntimeException: Failed to reset file system
    at org.sonar.process.monitor.Monitor.resetFileSystem(Monitor.java:127)
    at org.sonar.process.monitor.Monitor.startProcesses(Monitor.java:107)
    at org.sonar.process.monitor.Monitor.start(Monitor.java:101)
    at org.sonar.application.App.start(App.java:54)
    at org.sonar.application.App.main(App.java:141)
Caused by: java.nio.file.AccessDeniedException: /opt/sonarqube/temp/README.txt
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
    at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
    at java.nio.file.Files.delete(Files.java:1126)
    at org.sonar.application.AppFileSystem$CleanTempDirFileVisitor.visitFile(AppFileSystem.java:149)
    at org.sonar.application.AppFileSystem$CleanTempDirFileVisitor.visitFile(AppFileSystem.java:130)
    at java.nio.file.Files.walkFileTree(Files.java:2670)
    at org.sonar.application.AppFileSystem.createOrCleanTempDirectory(AppFileSystem.java:126)
    at org.sonar.application.AppFileSystem.reset(AppFileSystem.java:83)
    at org.sonar.process.monitor.Monitor.resetFileSystem(Monitor.java:124)
    ... 4 more

my docker file looks like –

  • How do I lookup Docker service member addresses using DNS?
  • Docker - Couldn't connect to Docker daemon
  • Ansible - Conditionally set volume and tls hostname based on inventory file in docker module
  • How to we login to docker hub(private registry) using chef recipe?
  • Shared volume/file permissions/ownership (Docker)
  • Docker save read arguments from stdin
  •  FROM rhel7:latest
    
    MAINTAINER Naveen Kumar02 <na>
    
    RUN set -x \
        && yum -y install tar unzip \
        && yum -y update \
        && yum -y clean all 
    
    ENV SONAR_VERSION=6.0 \
        SONARQUBE_HOME=/opt/sonarqube \
        # Database configuration
        # Defaults to using H2
        SONARQUBE_JDBC_USERNAME=sonar \
        SONARQUBE_JDBC_PASSWORD=sonar \
        SONARQUBE_JDBC_URL=
    #java
    ENV JAVA_HOME /opt/java
    ENV JAVA_VERSION_MAJOR 8
    ENV JAVA_VERSION_MINOR 102
    ENV JAVA_VERSION_BUILD 14
    
    RUN mkdir -p /opt \
      && curl --fail --silent --location --retry 3 \
      --header "Cookie: oraclelicense=accept-securebackup-cookie; " \
      http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/server-jre-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz \
      | gunzip \
      | tar -x -C /opt \
      && ln -s /opt/jdk1.${JAVA_VERSION_MAJOR}.0_${JAVA_VERSION_MINOR} ${JAVA_HOME}
    
    
    # Http port
    EXPOSE 9000
    
    RUN set -x \
    
        # see https://bugs.debian.org/812708
        # and https://github.com/SonarSource/docker-sonarqube/pull/18#issuecomment-194045499
        && cd /tmp \
        && cd /opt \
        && curl -o sonarqube.zip -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip \
    #    && curl -o sonarqube.zip.asc -fSL https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip.asc \
    #    && gpg --batch --verify sonarqube.zip.asc sonarqube.zip \
        && unzip sonarqube.zip \
        && mv sonarqube-$SONAR_VERSION sonarqube \
        && rm sonarqube.zip* \
        && rm -rf $SONARQUBE_HOME/bin/*
    
    RUN echo "-Djava.awt.headless=true" >> /opt/sonarqube/conf/wrapper.conf
    RUN echo "-Djava.io.tmpdir=/tmp" >> /opt/sonarqube/conf/wrapper.conf  
    
    
    WORKDIR /
    
    COPY containerfiles/run.sh /
    
    RUN chmod 777 /run.sh 
    
    #RUN useradd -r -u 200 -m -c "sonar role account" -d ${SONARQUBE_HOME} -s /bin/false sonar   
    
    #USER sonar
    
    VOLUME ["$SONARQUBE_HOME/data", "$SONARQUBE_HOME/extensions"]
    
    #RUN chmod  -R 755 $SONARQUBE_HOME
    #RUN chmod 755 $SONARQUBE_HOME/extensions
    #RUN chmod 755 /opt/sonarqube/temp/
    #RUN chmod 755 /opt/sonarqube/temp/README.txt
    
    WORKDIR $SONARQUBE_HOME
    
    #RUN chown -R sonar:sonar /opt/sonarqube/temp/
    
    ENV JAVA_MAX_MEM 1200m
    ENV JAVA_MIN_MEM 1200m
    #ENV EXTRA_JAVA_OPTS "-Djava.util.prefs.systemRoot=/nexus-data/.java -Djava.util.prefs.userRoot=/nexus-data/.java/.userPrefs"
    #ENV JAVA_OPTS "-Djava.awt.headless=true -Djava.io.tmpdir=/opt/temp"
    
    #COPY containerfiles/run.sh /
    #RUN chmod 755 $SONARQUBE_HOME/bin/run.sh
    
    #RUN chmod +x ${SONARQUBE_HOME}/bin/run.sh
    RUN useradd sonar
    RUN chown -R sonar /opt/sonarqube
    ENTRYPOINT ["/run.sh"]
    

    run.sh

    #!/bin/bash
    
    #chmod 777 /opt/java/bin/java
    /opt/java/bin/java -jar lib/sonar-application-$SONAR_VERSION.jar \
      -Dsonar.log.console=true \
      -Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \
      -Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \
      -Dsonar.jdbc.url="$SONARQUBE_JDBC_URL" \
      -Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS -Djava.security.egd=file:/dev/./urandom" \
      "$@"
    

    Could anyone please guide me to resolve this error ?

  • Azure VM with Docker failing to connect
  • How do I limit a volume's size using the API?
  • Pbs with python tempfile.mkdtemp in gitlab-ci docker
  • Docker: Why is /etc/resolv.conf unreadable? Breaks DNS [closed]
  • How do I run private docker images on Google Container Engine
  • Expose host port for specific container interface
  • One Solution collect form web for “Exception in thread “main” java.lang.RuntimeException: Failed to reset file system”

    I have now working sonarqube after changing following permissions.

    RUN mkdir -p /opt/sonarqube/bin/pid
    RUN chmod 777 /opt/sonarqube/bin/pid
    RUN cd /opt/sonarqube/bin/pid
    RUN chmod 777 /opt/sonarqube/logs
    #RUN chmod 777 /opt/sonarqube/bin/linux-x86-64
    RUN ln -s /opt/java/bin/java /usr/bin/java
    RUN chmod 777 /opt/sonarqube/temp
    RUN chmod 777 /opt/sonarqube/data
    RUN chmod 777 /opt/sonarqube/extensions
    RUN chmod 777 /opt/sonarqube/extensions/plugins/
    RUN chmod 777 /opt/sonarqube/lib/bundled-plugins
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.