以root用户身份打开shift容器



嗨,我正在openshift 3.9上进行CICD实现。我有一个詹金斯吊舱在露天移动。我在jenkins中运行selenium脚本,下面的错误就像丢失了一个包

Running TestSuite
/var/lib/jenkins/jobs/Pipeline/workspace/src/test/resources/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
Nov 21, 2018 8:25:36 AM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
Tests run: 8, Failures: 1, Errors: 0, Skipped: 7, Time elapsed: 21.9 sec <<< FAILURE! - in TestSuite
BrowserSettings(SecurityCheckList)  Time elapsed: 21.273 sec  <<< FAILURE!
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:25:02.294Z'
System info: host: 'jenkins-1-7zgld', ip: '10.131.0.32', os.name: 'Linux', os.arch: 'i386', os.version: '3.10.0-957.el7.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: ChromeDriver
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:148)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)

为此,我想通过以下命令在我的jenkins容器中安装libgconf-2-4

yum install libgconf-2-4

当我尝试安装以下错误时,出现在我的詹金斯容器中

sh-4.2$ yum install libgconf2-4
Loaded plugins: ovl, product-id, search-disabled-repos, subscription-manager
[Errno 13] Permission denied: '/etc/pki/entitlement-host'
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.

当我到达指定的位置并尝试将权限更改为chmod 777.dbenv.lock 时

sh-4.2$ cd /var/lib/rpm/
sh-4.2$ ls -latr
total 19560
-rw-r--r--. 1 root root        0 Aug  9 18:21 .dbenv.lock

它作为抛出错误

sh-4.2$ chmod 777 .dbenv.lock
chmod: changing permissions of ‘.dbenv.lock’: Operation not permitted

我的问题是,如何以root用户身份进入jenkinspod,并通过在openshift中安装libgconf-2-4来安装rpm包libgconf-2-4?

您似乎应该自定义jenkins图像,如下所示。[0]

  • 创建Dockerfile

    FROM registry.access.redhat.com/openshift3/jenkins-2-rhel7用户0运行yum-y安装libgconf2-4&&yum-clean-all-y用户1001
  • 使用Dockerfile构建图像。

    docker构建
  • 登录OpenShift的内部注册表进行推送镜像。

    docker login-u admin-p docker registry.default.svc:5000
  • 重新标记为OpenShift图像格式和您的标记策略。

    docker标签docker registry.default.svc:5000/openshift/jenkins-2-rhel7-custom
  • 按下image

    docker推送docker registry.default.svc:5000/openshift/jenkins-2-rhel7-custom
  • 编辑您的deploymentConfig

    oc编辑dc/jenkins。。。容器:。。。图片:"openshift/jenkins-2-rhel7-custom"…

我希望它能帮助你。:^(

[0]通用容器图像指南

您可以在dockerfile中使用USER root来解决问题

相关内容

  • 没有找到相关文章

最新更新