通过docker在Local主持的詹金斯(Jenkins)在Local主机上运行

发布于 2025-01-21 09:02:37 字数 510 浏览 1 评论 0原文

我想通过2个条件在Localhost上在Localhost上运行Jenkins。

  1. 我需要端口443
  2. 它应该是https://而不是http://

我尝试了所有事情,但是我仍然陷入困境。

这是我用来在端口443上运行jenkins的命令:

docker run -p 443:8080 -p 50000:50000:50000 -v〜/jenkins_home:/var/var/jenkins_home jenkins/jenkins/jenkins/jenkins/jenkins/jenkins:lts

it Transfers端口为443,但不会使其成为https。
我在root文件夹(/users/myname/)中的mkcert中有我的证书和键。但是我不知道如何将其传输到Jenkins配置。

有办法做到吗?

I want to run jenkins on localhost via docker with 2 conditions.

  1. I need port 443
  2. it should be https:// instead of http://

I tried everything, but I am still stuck with this issues.

This is the command I am using to run jenkins on port 443:

docker run -p 443:8080 -p 50000:50000 -v ~/jenkins_home:/var/jenkins_home jenkins/jenkins:lts

It transfers the port to 443, but does not make it HTTPS.
I have my cert and key from mkcert in root folder(/users/myname/). But I do not know how to transfer it to Jenkins configurations.

Is there a way to do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守望孤独 2025-01-28 09:02:37

jenkins初始

  • 设置http_port :禁用(因为您使用的https),请使用-1。
  • -httpsport = $ https_port:在端口上使用https协议$ https_port

因此,如果您想使用HTTPS运行Jenkins,则需要:

  • 激活HTTPS端口(并映射)
  • 通过自我签名的证书,

您有一个完整的示例在此处,运行:

read -s -p "Keystore Password:" password
echo
sudo cp jenkins_keystore.jks /var/lib/docker/volumes/jenkins_home/_data

和:

docker run -d -v jenkins_home:/var/var/jenkins_home -v $(哪个docker):/usr/usr/bin/docker -v/var/var/var/var/var/ run/docker.sock:/var/run/docker.sock -p 443:8443 -p 50000:50000 jenkins/jenkins/jenkins:lts -httpport = -1 -1 -httpsport = 8443 -httpskeystore =/httpskeystore =/ .jks -httpskeystorepassword = $ password

The Jenkins initial settings includes

  • --httpPort=$HTTP_PORT: To disable (because you’re using HTTPS), use port -1.
  • --httpsPort=$HTTPS_PORT: Uses HTTPS protocol on port $HTTPS_PORT.

So if you want to run Jenkins with HTTPS, you need:

  • to activate an HTTPS port (and map it)
  • to pass a self-signed certificate

You have a full example here, run with:

read -s -p "Keystore Password:" password
echo
sudo cp jenkins_keystore.jks /var/lib/docker/volumes/jenkins_home/_data

And:

docker run -d -v jenkins_home:/var/jenkins_home -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -p 443:8443 -p 50000:50000 jenkins/jenkins:lts --httpPort=-1 --httpsPort=8443 --httpsKeyStore=/var/jenkins_home/jenkins_keystore.jks --httpsKeyStorePassword=$password

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文