我正在设置jenkins以通过docker运行。但是似乎遇到了障碍。
通过CLI登录以验证是否已安装docker和jenkins映像。
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 8 weeks ago 1.84kB
jenkins latest cd14cecfdb3a 7 months ago 696MB
设置端口
docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home:z -t jenkins
验证容器正在运行:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ff1f21312230 jenkins "/bin/tini -- /usr/l…" About an hour ago Up About an hour 50000/tcp, 0.0.0.0:49001->8080/tcp nostalgic_mestorf
检查主机是否可以本地访问
curl localhost:49001
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2F'/><script>window.location.replace('/login?from=%2F');</script></head><body style='background-color:white; color:white;'>
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Administer
-->
</body></html>
尝试连接到端口8080无效。
curl localhost:8080
curl: (7) Failed connect to localhost:8080; Connection refused
在AWS上运行Red Hat Enterprise Linux Server 7.6(Maipo)
我如何允许访问以便让Jenkins加载?我究竟做错了什么?任何帮助,将不胜感激。
答案 0 :(得分:1)
您将端口49001转发到Docker容器的端口8080。这就是访问Jenkins的方式。您似乎对curl localhost:49001
得到了正确的答复。它要求您登录。</ p>
还请注意,jenkins
图片已被弃用。您应该改用jenkins/jenkins:lts
。