How to deploy mean stack application in docker? - docker

How to deploy a mean stack application in docker?
I have an error in mongodb connection.so mean stack web application is not responding.
Here are my steps:
Pulled the image from DockerHub:
sudo docker pull crissi/airlineinsurance
Verified Images
sudo docker images
Run the mongodb Container
sudo docker run -d -p 27017:27017 --name airlineInsurance -d mongo
Verified it is running:
sudo docker ps -l
Run the Application Container
sudo docker run -d -P crissi/airlineinsurance
Verified with:
sudo docker ps -l
Checking the logs
sudo docker logs 8efba551fdc6
The resulted log is as follows:
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Server running at http://127.0.0.1:9000
Server running at https://127.0.0.1:9030
/app/node_modules/mongodb/lib/server.js:261
process.nextTick(function() { throw err; })
^
MongoError: failed to connect to server [localhost:27017] on first connect
at Pool.<anonymous> (/app/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:96:13)
at Pool.emit (events.js:188:7)
at Connection.<anonymous> (/app/node_modules/mongodb-core/lib/connection/pool.js:271:12)
at Connection.g (events.js:291:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:165:49)
at Socket.g (events.js:291:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1281:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
[nodemon] app crashed - waiting for file changes before starting...
I have included DockerFile for your reference
# Tells the Docker which base image to start.
FROM node
# Adds files from the host file system into the Docker container.
ADD . /app
# Sets the current working directory for subsequent instructions
WORKDIR /app
RUN npm install
RUN npm install -g bower
RUN bower install --allow-root
RUN npm install -g nodemon
#expose a port to allow external access
EXPOSE 9030
# Start mean application
CMD ["nodemon", "server.js"]

It depends on how you define your Dockerfile.
Since your app involves multiple processes (your app + mongodb), you could use supervisor to launch both.
See this example using a supervisord.conf like:
[supervisord]
nodaemon=true
[program:mongod]
command=/usr/bin/mongod --smallfiles
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true
[program:nodejs]
command=nodejs /opt/app/server/server.js
Replace the nodejs command by your own application.

Related

How to create _users database when launching CouchDB in Docker container?

I have created this Dockerfile:
FROM couchdb:latest
EXPOSE 5984
COPY local.ini /opt/couchdb/etc/
But even though I specified [admins] inside of the local.ini, I still get this error at launch:
[error] 2022-11-06T17:55:49.799365Z nonode#nohost emulator -------- Error in process <0.15793.0> with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,400}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,375}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,404}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,97}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,198}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,145}]}]}
What do I need to do in order to avoid this error?
Dockerfile
FROM couchdb:latest
EXPOSE 5984
COPY setup.sh setup.sh
RUN sh setup.sh
setup.sh
#!/bin/sh -xe
cat >/opt/couchdb/etc/local.ini <<EOF
[couchdb]
single_node=true
[admins]
dbadmin = $(base32 /dev/random |head -1|cut -c-24)
EOF
nohup bash -c "/docker-entrypoint.sh /opt/couchdb/bin/couchdb &"
sleep 15
curl -X PUT http://127.0.0.1:5984/_users
curl -X PUT http://127.0.0.1:5984/_replicator

Unable to connect local scala app with Hbase running in docker

I have spent the entire day trying to figure out why my sscala app running on windows is unable to make a successful connection with hbase running in a docker container.
I can shell into the container and run the hbase shell, create tables etc
Also I can port forward to localhost:16010 and see the Hbase UI. Some additional details of the setup as follows.
Env:
Scala app: Windows (host)
Hbase: docker container
Docker container details
FROM openjdk:8
ENV HBASE_VERSION=2.4.12
RUN apt-get update
RUN apt-get install -y netcat
RUN mkdir -p /var/hbase && \
cd /opt && \
wget -q https://archive.apache.org/dist/hbase/${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz && \
tar xzf hbase-${HBASE_VERSION}-bin.tar.gz
WORKDIR /opt/hbase-${HBASE_VERSION}
COPY hbase-site.xml conf
CMD ./bin/start-hbase.sh && tail -F logs/hbase*.log
hbase-site.xml -> hbase.cluster.distributed & hbase.unsafe.stream.capability.enforce set to false
The hbase container is up and running and accesible. Also confirmed zookeeper is reachable within the container as well as from the host using echo ruok | nc localhost 2181; echo
Running container as follows:
docker run -it -p 2181:2181 -p 2888:2888 -p 3888:3888 -p 16010:16010 -p 16000:16000 -p 16020:16020 -p 16030:16030 -p 8080:8080 -h hbb hbase-1
Scala app
val conf : Configuration = HBaseConfiguration.create()
conf.set("hbase.zookeeper.quorum", "hbb")
conf.set("hbase.zookeeper.property.clientPort", "2181")
conf.set("hbase.master", "hbb")
conf.set("hbase.cluster.distributed","false")
// conf.set("hbase.client.pause", "1000")
// conf.set("hbase.client.retries.number", "2")
// conf.set("zookeeper.recovery.retry", "1")
val connection = ConnectionFactory.createConnection(conf)
The part of the stack trace
1043 [ReadOnlyZKClient-hbb:2181#0x30b6ffe0] DEBUG org.apache.zookeeper.ClientCnxn - zookeeper.disableAutoWatchReset is false
3947 [ReadOnlyZKClient-hbb:2181#0x30b6ffe0-SendThread(hbb:2181)] INFO org.apache.zookeeper.ClientCnxn - Opening socket connection to server hbb:2181. Will not attempt to authenticate using SASL (unknown error)
3949 [ReadOnlyZKClient-hbb:2181#0x30b6ffe0-SendThread(hbb:2181)] WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server hbb:2181, unexpected error, closing socket connection and attempting reconnect
java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:100)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:620)
at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064)
3953 [ReadOnlyZKClient-hbb:2181#0x30b6ffe0-SendThread(hbb:2181)] DEBUG org.apache.zookeeper.ClientCnxnSocketNIO - Ignoring exception during shutdown input
java.net.SocketException: Socket is not connected
at sun.nio.ch.Net.translateToSocketException(Net.java:122)
at sun.nio.ch.Net.translateException(Net.java:156)
at sun.nio.ch.Net.translateException(Net.java:162)
at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:401)
at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200)
at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1250)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1174)
I have tried changing the hbase.zookeeper.quorum & master props on the client side to localhost / 127.0.0.1 as well as changing the etc/hosts file with the container id. No luck yet
Would greatly appreciate some guidance on this :)

Issue regarding the deployment of a Meteor Application on Google Cloud App Engine: APP_CONTAINER_CRASHED

TL;DR
Clone this: https://github.com/calvan-liang/radgrad2googlecloudissue.
Ensure you have meteor-google-cloud and gcloud CLI installed. If not:
On Powershell:
npm install meteor-google-cloud -g
On Ubuntu Terminal:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg]
https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a
/etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates gnupg
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --
keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
meteor-google-cloud --init
If not successful or not Ubuntu: https://cloud.google.com/sdk/install
To deploy, in the app directory:
meteor-google-cloud --settings deploy/settings.json --app deploy/app.yml --
docker deploy/Dockerfile
What is the cause of the APP_CONTAINER_CRASHED and how can it be resolved?
.
.
.
.
.
Currently following the README.md from https://github.com/EducationLink/meteor-google-cloud to deploy a pre-existing project using Google Cloud. On the fourth step of deploy. While the default service is updating, I receive this error:
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED
/app/programs/server/node_modules/fibers/future.js:313
throw(ex);
^
MongoNetworkError: failed to connect to server [bla.com:27017] on first connect [MongoNetworkError: connection timed out
at connectionFailureError (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connect.js:406:14)
at Socket.<anonymous> (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connect.js:294:16)
at Object.onceWrapper (events.js:417:28)
at Socket.emit (events.js:311:20)
at Socket.EventEmitter.emit (domain.js:482:12)
at Socket._onTimeout (net.js:478:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
name: 'MongoNetworkError',
[Symbol(mongoErrorContextSymbol)]: {}
}]
at Pool.<anonymous> (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/topologies/server.js:438:11)
at Pool.emit (events.js:311:20)
at Pool.EventEmitter.emit (domain.js:482:12)
at /app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/pool.js:561:14
at /app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/pool.js:994:11
at /app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connect.js:31:7
at callback (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connect.js:264:5)
at Socket.<anonymous> (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connect.js:294:7)
at Object.onceWrapper (events.js:417:28)
at Socket.emit (events.js:311:20)
at Socket.EventEmitter.emit (domain.js:482:12)
at Socket._onTimeout (net.js:478:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
name: 'MongoNetworkError',
[Symbol(mongoErrorContextSymbol)]: {}
}
Pre-existing project that is used is cloned from https://github.com/radgrad/radgrad2. I added a deploy directory in radgrad2/app. Inside the deploy directory, there are these files:
Dockerfile
FROM gcr.io/google_appengine/nodejs
RUN install_node {{ nodeVersion }}
RUN npm install npm#{{ npmVersion }}
RUN node -v
RUN npm -v
COPY . /app/
RUN (cd programs/server && npm install --unsafe-perm)
CMD node main.js
app.yml
runtime: custom
service: default
env: flex
threadsafe: true
zones:
- us-west3-b
- us-west3-c
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 20
network:
session_affinity: true
automatic_scaling:
max_num_instances: 2
skip_files:
- ^(.*/)?\.dockerignore$
- ^(.*/)?\yarn-error.log$
- ^(.*/)?\.git$
- ^(.*/)?\.hg$
- ^(.*/)?\.svn$
settings.json
{
"public": {},
"private": {},
"meteor-google-cloud": {
"project": "radgrad2test",
"stop-previous-version": "",
"env_variables": {
"MONGO_URL": "mongodb://user:pw#bla.com",
"ROOT_URL": "https://example.de"
}
}
}
Note that I am running this on Windows 10 Home using WSL 2 with Docker Desktop.
What may be possibly causing the app container to crash? How could I resolve this issue or where should I be looking to find the origin of this problem?
MongoNetworkError: failed to connect to server
This was a bug that has just recently being fixed in the newest Meteor version:
In some MongoDB host providers like ScaleGrid and IBM Cloud some developers are getting this error because of certificate
MongoNetworkError: failed to connect to server [sg-meteorappdb-32194.servers.mongodirector.com:27017] on first connect [Error: self signed certificate
So in order to fix this, there has is now the option to configure Mongo options through your Meteor settings.json file. It is now added to the documentation:
"packages": {
"mongo": {
"options": {
"tls": true,
"tlsCAFileAsset": "certificate.pem"
}
}
}
Thanks for the suggestion. I added the above to the settings.json file and unfortunately it did not recognize ''certificate.pem"
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED
/app/programs/server/node_modules/fibers/future.js:280
throw(ex);
^
Error: ENOENT: no such file or directory, open '/app/programs/server/assets/app/certificate.pem'
at Object.openSync (fs.js:457:3)
at Object.readFileSync (fs.js:359:35)
at /app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/connect.js:243:32
at Array.forEach (<anonymous>)
at resolveTLSOptions (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/connect.js:241:34)
at /app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/connect.js:294:5
at parseConnectionString (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/uri_parser.js:685:3)
at connect (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/operations/connect.js:272:3)
at /app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongo_client.js:215:5
at maybePromise (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/utils.js:719:3)
at MongoClient.connect (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongo_client.js:211:10)
at Function.MongoClient.connect (/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongo_client.js:421:22)
at new MongoConnection (packages/mongo/mongo_driver.js:206:11)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/app/programs/server/assets/app/certificate.pem'
}
What could I do to resolve this issue? I ensured that I installed the latest version of meteor.
Allowing invalid certificates does not work either. I run into the same MongoNetworkError: failed to connect to server [bla.com:27017] on first connect [MongoNetworkError: connection timed out problem if I allow invalid certificates.

How to bind mounted persistent volumes on docker ? I'm trying to run Sonarqube on docker

I want to run SonarQube on docker. When I run the whiteout volume persist option, it works properly with this command:
docker run -d --name sonarqube -p 9000:9000 sonarqube
But when I try to set bind-mounted persistent volumes, my docker doesn't start. The docker command used is:
docker run -d --name sonarqube \
-p 9000:9000 \
-v /opt/docker-mounts/sonaarqube/conf:/opt/sonarqube/conf \
-v /opt/docker-mounts/sonaarqube/data:/opt/sonarqube/data \
-v /opt/docker-mounts/sonaarqube/logs:/opt/sonarqube/logs \
-v /opt/docker-mounts/sonaarqube/extensions:/opt/sonarqube/extensions \
sonarqube
Note: I run docker command with root privilege.
I use this SonarQube image from Docker Hub: https://hub.docker.com/_/sonarqube?tab=description
I get this Error in docker logs :
>
06:42:37.293 [main] WARN org.sonar.application.config.AppSettingsLoaderImpl - Configuration file not found: /opt/sonarqube/conf/sonar.properties
2019.07.07 06:42:37 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.07.07 06:42:37 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.07.07 06:42:37 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.07.07 06:42:38 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.07.07 06:42:38 INFO app[][o.e.p.PluginsService] no modules loaded
2019.07.07 06:42:38 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019-07-07 06:42:41,143 main ERROR Unable to create file /opt/sonarqube/logs/es.log java.io.IOException: Permission denied
at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.base/java.io.File.createNewFile(File.java:1024)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:628)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:608)
at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113)
at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:145)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:61)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,148 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory#5dcd8c7a] unable to create manager for [/opt/sonarqube/logs/es.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData#2250b9f2[pattern=/opt/sonarqube/logs/es.%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=-2147483648, max=2147483647, useMax=false), advertiseURI=null, layout=%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{1.}] %msg%n, filePermissions=null, fileOwner=null]] java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory#5dcd8c7a] unable to create manager for [/opt/sonarqube/logs/es.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData#2250b9f2[pattern=/opt/sonarqube/logs/es.%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=-2147483648, max=2147483647, useMax=false), advertiseURI=null, layout=%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{1.}] %msg%n, filePermissions=null, fileOwner=null]]
at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:115)
at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:145)
at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:61)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,152 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:235)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:959)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:899)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:891)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:234)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:127)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:302)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
2019-07-07 06:42:41,154 main ERROR Null object returned for RollingFile in Appenders.
2019-07-07 06:42:41,154 main ERROR Unable to locate appender "file_es" for logger config "root"
2019.07.07 06:42:41 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2019.07.07 06:42:41 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.07.07 06:42:41 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
I think you have persistented the volumes but there is no file and required permissions. Follow below steps.
Start the container without persistent volume
$ docker run -d --name sonarqube -p 9000:9000 sonarqube
$ docker ps -f name=sonarqube
Note down the container id.
Copy folders from the container to host directory
$ cd /opt/docker-mounts/sonaarqube
$ chown -R 999:999 .
$ docker cp -a CONTAINER_ID:/opt/sonarqube/conf .
$ docker cp -a CONTAINER_ID:/opt/sonarqube/logs . # this can be skipped is not required
$ docker cp -a CONTAINER_ID:/opt/sonarqube/data . # optional, if you need the existing data from the container
$ docker cp -a CONTAINER_ID:/opt/sonarqube/extensions .
Now start the container with persistent volumes
$ docker run -d --name sonarqube \
-p 9000:9000 \
-v /opt/docker-mounts/sonaarqube/conf:/opt/sonarqube/conf \
-v /opt/docker-mounts/sonaarqube/data:/opt/sonarqube/data \
-v /opt/docker-mounts/sonaarqube/logs:/opt/sonarqube/logs \
-v /opt/docker-mounts/sonaarqube/extensions:/opt/sonarqube/extensions \
sonarqube

Unable to install chef-server on docker container

I am unable to install chef-server (chef-server-core_12.0.8-1_amd64.deb) over a docker container (Ubuntu 14.04 x86_64).
When running chef-server-ctl reconfigure it fails with following error:
Error executing action run on resource 'execute[/opt/opscode/bin/private-chef-ctl start rabbitmq]'
Mixlib::ShellOut::ShellCommandFailed
Expected process to exit with [0], but received '1'
---- Begin output of /opt/opscode/bin/private-chef-ctl start rabbitmq ----
STDOUT: warning: rabbitmq: unable to open supervise/ok: file does not exist
STDERR:
---- End output of /opt/opscode/bin/private-chef-ctl start rabbitmq ----
Ran /opt/opscode/bin/private-chef-ctl start rabbitmq returned 1
NOTE: Before starting installation , I have done following steps inside the container:
dpkg-divert --local --rename --add /sbin/initctl
ln -sf /bin/true /sbin/initctl
sysctl -w kernel.shmmax=17179869184
Is there any other work-around to get chef-server up on docker container.

Resources