Skip to content

Commit

Permalink
docker image where agent is run as "agent" user
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneGerardVUB committed Oct 21, 2024
1 parent d64e780 commit 1af74e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions azure-pipelines-azureagent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ RUN tar -xzf $TARBALL && rm $TARBALL
COPY files/start.sh .
RUN chmod +x start.sh run.sh

# Create agent user and set up home directory
RUN groupadd -g 477 agent
RUN useradd -u 950 -g 477 -m -d /home/agent agent
RUN chown -R agent:agent /azp /home/agent

USER agent
# Another option is to run the agent as root.
# ENV AGENT_ALLOW_RUNASROOT="true"

ENTRYPOINT [ "./start.sh" ]
2 changes: 1 addition & 1 deletion azure-pipelines-azureagent/files/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

export AGENT_ALLOW_RUNASROOT="1"
#export AGENT_ALLOW_RUNASROOT="1"

print_header() {
lightcyan='\033[1;36m'
Expand Down

0 comments on commit 1af74e1

Please sign in to comment.