kitchen-docker icon indicating copy to clipboard operation
kitchen-docker copied to clipboard

non-root docker-container failed to start .e.g Jenkins

Open kknd22 opened this issue 6 years ago • 2 comments

Unsuccessfully try to use official Jenkins container for kitchen-test. Digged a bit more and discovered that user is set to a non root 'jenkins' https://github.com/jenkinsci/docker/blob/587b2856cd225bb152c4abeeaaa24934c75aa460/Dockerfile#L66
https://github.com/jenkinsci/docker/blob/587b2856cd225bb152c4abeeaaa24934c75aa460/Dockerfile#L5

The error is:

Step 3/16 : RUN yum clean all
 ---> Using cache
 ---> ef4ad2349c4
Step 4/16 : RUN yum install -y sudo openssh-server openssh-clients which curl
 ---> Running in bd2wr4a8139
Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.dbenv.lock'
You need to be root to perform this command.

Tried adding in .kitchen.yml :

platforms:
  - name: centos-7   
    driver_config:
      image: jenkins
      run_options: --user=root:root

Without any luck.

Any help would be appreciated. -ChrisL

BTW, this is not a Jenkins specific issue but for any container run not as root. Kitchen-Docker seems to have no way around this

kknd22 avatar May 29 '19 19:05 kknd22

I am experiencing the same issue. I see the dockerfile portion of the linux.rb requires sudo privileges.

https://github.com/test-kitchen/kitchen-docker/blob/c43a4af9c16cd9ccfa432480049804a7fc3c8659/lib/kitchen/docker/container/linux.rb#L106-L192

We are planning on running containers without a root user... Are there any plans to support running kitchen-docker without root/sudo privileges? Thanks

ObiH15 avatar Aug 30 '19 16:08 ObiH15

Any news about this issue?

lmayorga1980 avatar May 27 '20 17:05 lmayorga1980