justb4 / docker-jmeter

Docker image for Apache JMeter
MIT License
278 stars 310 forks source link

Can't run container with custom user #71

Open dil-kpogany opened 1 year ago

dil-kpogany commented 1 year ago

Hi,

I'm running jmeter tests as part of my CI pipeline and I'd like to create artifacts from it's results/output. I'd like to run justb4/jmeter under a service user as without running it under the service user, the output files are created as root and can't be removed from the runner host by the service user. The service user does not have sudo right. Do you have any ideas how I could fix it? Currently, I use the --user option the following way: docker run -u $(id -u ${USER}):$(id -g ${USER}) --volume ${{ github.workspace }}/utils:/tmp/ --volume ${{ runner.temp }}/${{ github.run_number }}/:/results justb4/jmeter -n -t /tmp/jmeter/qst_child_questions.jmx -l /results/qst_test_report.csv -e -o /results/html -Jthreads=1 -Jcsvfile=/tmp/jmeter/panda02_config.csv -JquestionCount=1 -JchildQuestionCount=200

This gives me the following output:

START Running Jmeter on Tue Jan 17 14:29:32 CET 2023
JVM_ARGS=-Xmn1274m -Xms5096m -Xmx5096m
jmeter args=-n -t /tmp/jmeter/qst_child_questions.jmx -l /results/qst_test_report.csv -e -o /results/html -Jthreads=1 -Jcsvfile=/tmp/jmeter/questionnaires_panda02_config.csv -JquestionCount=1 -JchildQuestionCount=200
jmeter ALL ARGS=-Dlog4j2.formatMsgNoLookups=true -n -t /tmp/jmeter/qst_child_questions.jmx -l /results/qst_test_report.csv -e -o /results/html -Jthreads=1 -Jcsvfile=/tmp/jmeter/questionnaires_panda02_config.csv -JquestionCount=1 -JchildQuestionCount=200
2023-01-17 14:29:33,434 main ERROR FileManager (jmeter.log) java.io.FileNotFoundException: jmeter.log (Permission denied) java.io.FileNotFoundException: jmeter.log (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory.createManager(FileManager.java:43[8](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:9))
    at org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory.createManager(FileManager.java:422)
    at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:144)
    at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:100)
    at org.apache.logging.log4j.core.appender.FileManager.getFileManager(FileManager.java:182)
    at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:[9](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:10)6)
    at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:52)
    at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:124)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:[10](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:11)47)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1039)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:249)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:295)
    at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:7[11](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:12))
    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at org.apache.jmeter.JMeter.<clinit>(JMeter.java:113)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.jmeter.NewDriver.main(NewDriver.java:257)

2023-01-17 14:29:33,444 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.FileAppender for element File: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory@5e0826e7] unable to create manager for [jmeter.log] with data [org.apache.logging.log4j.core.appender.FileManager$FactoryData@32eff876] java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory@5e0826e7] unable to create manager for [jmeter.log] with data [org.apache.logging.log4j.core.appender.FileManager$FactoryData@32eff876]
    at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:146)
    at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:100)
    at org.apache.logging.log4j.core.appender.FileManager.getFileManager(FileManager.java:182)
    at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:96)
    at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:52)
    at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:[12](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:13)4)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1047)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1039)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:249)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:295)
    at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:[13](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:14)7)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at org.apache.jmeter.JMeter.<clinit>(JMeter.java:113)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.jmeter.NewDriver.main(NewDriver.java:257)

2023-01-17 [14](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:15):29:33,447 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.FileAppender for element File: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.FileAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.FileAppender
    at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:238)
    at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1047)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1039)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:249)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:295)
    at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:[15](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:16)5)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:[19](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:20)6)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at org.apache.jmeter.JMeter.<clinit>(JMeter.java:113)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:4[23](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:24))
    at org.apache.jmeter.NewDriver.main(NewDriver.java:[25](https://github.com/DiligentCorp/questionnaires-service/actions/runs/3939722738/jobs/6739911345#step:4:26)7)