In the .gitlab-ci.yaml file, I need to use the keyword image to use a Docker image like this:
- stage: dast*
- image: my-docker-image*
The problem is that I don’t know how to specify the user to start the docker image with.
In local, the command that I run to use the docker image is as follows:
docker run -v $(pwd):/zap/wrk/:rw -u root -it my-docker_image
Do you know how can I indicate the user to use when starting the image?
Thanks in advance for your help.
there is no such option, the Docker image will run as the image’s default user.
There isn’t an easy way to do exactly what you want, but there are two ways to do something very similar:
- You could build your own
Dockerfile in a preceding pipeline stage, which has the correct
USER set, then push that container to the GitLab registry. Then your
zap job can run with the new container which has the right user running.
- If you are using your own servers / runners, you could use a shell executor and just put
docker run -v $(pwd):/zap/wrk/:rw -u root -it my-docker_image in your