Home > front end >  gitlab-ci docker | using sudo inside container
gitlab-ci docker | using sudo inside container

Time:10-25

Hey fellow developers,

I use gitlab-ci, with my own gitlab-runner running as a docker image on the server (Ubuntu 22.04, Docker 20.10, Docker image: gitlab/gitlab-runner:latest).

I want to use some sudo commands inside the container.

How can I do that ?

Thanks for any help.

CodePudding user response:

You can install sudo from you docker file:

FROM gitlab/gitlab-runner:latest

RUN apt-get update && \
      apt-get -y install sudo

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker 
sudo

USER docker
CMD /bin/bash
  • Related