Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run container as non root user #27

Open
zouroto opened this issue Sep 2, 2019 · 3 comments
Open

Run container as non root user #27

zouroto opened this issue Sep 2, 2019 · 3 comments

Comments

@zouroto
Copy link

zouroto commented Sep 2, 2019

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 [email protected]

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"]

@mcamier
Copy link

mcamier commented Sep 2, 2019

+1 got the same issue

@nicolaspernoud
Copy link

Hello,

I would like to do that as well.

Thanks

@yayayahei
Copy link

+1

yayayahei pushed a commit to yayayahei/gatling that referenced this issue Apr 29, 2020
yayayahei pushed a commit to yayayahei/gatling that referenced this issue Apr 29, 2020
yayayahei pushed a commit to yayayahei/gatling that referenced this issue Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants