0
votes

I am doing a university project for which I need to a gitlab-ci.yml . So test the gitlab-ci file I installed docker and gitlab runner on my local PC. Now when i run the gitlab runner for the build job, build fails. The reason is, this is a big project which has many library dependencies, and some libraries have sudo make install in their makefiles.

Usually when I run the build locally (without gitlab runner), at the install step it asks for password to proceed with the installation. But how do I achieve this while running in gitlab runner? Is there a way to make the docker container run as root ?

Please advice

2

2 Answers

0
votes

Here are the ways to resolve it:

  • make build as root user
  • setup password-less sudo so during build time you (scripts) can do make install (see how to configure PAM modules)
  • it looks like you have a CMake based project, then you can make, say image/ directory inside your container (any writable location, probably the build directory) and tell to CMake -DCMAKE_INSTALL_PREFIX=<your-build-dir>/image, then point other porject to search dependencies in the installed image. And you don't need to be root for this.
0
votes

Did some googling around and finally made it to work.

Specifying sudo inside docker container which is running as root will not work, as sudo command was not available. So what I did is create a user called docker to run inside docker container and add him to the sudoers list. Then the sudo command was available and sudo make install was successfull !!