8000 Run container as non root user · Issue #27 · denvazh/gatling · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Run container as non root user #27
Open
@zouroto

Description

@zouroto

Hello,

I'm trying to use your docker image for gatling tests.
It works great on my computer, as well on my ci product : Bamboo.
At the end of the execution, i store the generated result (gatling web site) into a Bamboo artifact.
The issue here is : the simulation reports are stacking into the gatling/result directory each time a bamboo execution is launched.
So i managed to clean up the environment before gatling execution, and i get an error : permission denied.
I'm not able to delete previous report because, report are created with the root user in the container, and my bamboo user does not have enough privileges.

I have modified your docker file to create a non root user and group that is configured through env variable from the docker run command.
Here, the created docker user is configured with a same group that my bamboo user (let say 1024).
Doing this way, i can clean up my bamboo workspace before gatling run.

As i'm not an docker expert, could you please have a look on my docker file, but i'm not sure this is the best way to do it.
At least, could you consider to add an option to your docker file to enable run from non root user ?

Thank you

FROM openjdk:8-jdk-alpine

MAINTAINER Denis Vawzhenin denis.vazhenin@me.com

WORKDIR /opt

ENV GATLING_VERSION 3.0.3
ENV USER_GROUP_ID 1024
ENV USER_GROUP_NAME gatling
ENV USER_NAME gatling

RUN addgroup --gid $USER_GROUP_ID $USER_GROUP_NAME
RUN adduser -D -H -G $USER_GROUP_NAME $USER_NAME

RUN mkdir -p gatling

RUN apk add --update wget bash libc6-compat &&
mkdir -p /tmp/downloads &&
wget -q -O /tmp/downloads/gatling-$GATLING_VERSION.zip
https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/$GATLING_VERSION/gatling-charts-highcharts-bundle-$GATLING_VERSION-bundle.zip &&
mkdir -p /tmp/archive && cd /tmp/archive &&
unzip /tmp/downloads/gatling-$GATLING_VERSION.zip &&
mv /tmp/archive/gatling-charts-highcharts-bundle-$GATLING_VERSION/* /opt/gatling/ &&
rm -rf /tmp/*

WORKDIR /opt/gatling

VOLUME ["/opt/gatling/conf", "/opt/gatling/results", "/opt/gatling/user-files"]

ENV PATH /opt/gatling/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV GATLING_HOME /opt/gatling

RUN chown -R $USER_NAME:$USER_GROUP_NAME /opt/gatling

ENTRYPOINT ["gatling.sh"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0