Home > Enterprise >  I can't access Jenkins at http://localhost:8080 with Docker on MacOS
I can't access Jenkins at http://localhost:8080 with Docker on MacOS

Time:09-28

I typed docker pull jenkins/jenkins:lts-jdk11 to get a Jenkins image on Docker Desktop on MacOS and ran it.

Here are the logs :

user@MacBook-Pro ~ % docker pull jenkins/jenkins:lts-jdk11
lts-jdk11: Pulling from jenkins/jenkins
4544405c869e: Already exists 
053893571470: Already exists 
09443be43c92: Already exists 
245a3ac7248d: Already exists 
945be0a39d66: Already exists 
345223d4887e: Already exists 
7456b7b2d084: Already exists 
b45efbe3b729: Already exists 
844a2b426b1d: Already exists 
24583556fd6c: Already exists 
2897437500f5: Already exists 
476474UDUDGD: Already exists 
67GDGD6DFFDF: Already exists 
FD63635E6553: Already exists 
Digest: sha256:5508cb1317aa0ede06cb34767fb5643860d1307109ade577d5df871f62170678
Status: Downloaded newer image for jenkins/jenkins:lts-jdk11
docker.io/jenkins/jenkins:lts-jdk11
user@MacBook-Pro ~ % docker images
REPOSITORY        TAG         IMAGE ID       CREATED       SIZE
jenkins/jenkins   lts-jdk11   c1ae8e3564e4   2 weeks ago   453MB
user@MacBook-Pro ~ % docker run c1ae8e3acfe4
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-09-27 20:45:33.606 0000 [id=1] INFO    winstone.Logger#logInternal: Beginning extraction from war file
2022-09-27 20:45:34.165 0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2022-09-27 20:45:34.198 0000 [id=1] INFO    org.eclipse.jetty.server.Server#doStart: jetty-10.0.11; built: 2022-06-21T21:12:44.640Z; git: d988aa016e0bb2de6fba84c1645649c72eae3e32; jvm 11.0.16.1 1
2022-09-27 20:45:34.369 0000 [id=1] INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2022-09-27 20:45:34.398 0000 [id=1] INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
2022-09-27 20:45:34.641 0000 [id=1] INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-09-27 20:45:34.783 0000 [id=1] INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@4d8286c4{Jenkins v2.361.1,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
2022-09-27 20:45:34.795 0000 [id=1] INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@e84a8e1{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2022-09-27 20:45:34.809 0000 [id=1] INFO    org.eclipse.jetty.server.Server#doStart: Started Server@32c85649{STARTING}[10.0.11,sto=0] @1559ms
2022-09-27 20:45:34.811 0000 [id=24]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2022-09-27 20:45:34.926 0000 [id=31]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2022-09-27 20:45:34.946 0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2022-09-27 20:45:35.328 0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2022-09-27 20:45:35.331 0000 [id=30]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2022-09-27 20:45:35.337 0000 [id=35]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2022-09-27 20:45:35.460 0000 [id=33]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2022-09-27 20:45:35.461 0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2022-09-27 20:45:35.461 0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2022-09-27 20:45:35.462 0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2022-09-27 20:45:35.496 0000 [id=49]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started Download metadata
2022-09-27 20:45:35.501 0000 [id=49]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/var/jenkins_home/war/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2022-09-27 20:45:35.930 0000 [id=29]    INFO    jenkins.install.SetupWizard#init: 

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

754547907ce14281b349837d4acd8786

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

2022-09-27 20:45:48.128 0000 [id=49]    INFO    h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
2022-09-27 20:45:48.129 0000 [id=49]    INFO    hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
2022-09-27 20:45:48.131 0000 [id=49]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Finished Download metadata. 12,634 ms
2022-09-27 20:45:48.226 0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2022-09-27 20:45:48.235 0000 [id=23]    INFO    hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running

I'm not dreaming. I see "Jenkins is fully up and running" at the very end of the logs but when I type http://localhost:8080/ in Chrome I end up on a page "This site can't be reached".

Anyone knows why I can't use Jenkins anymore ? It used to work before... It sucks. At the beginning, I had removed the image to download it again because I've got problems with the Cmake plugin and now absolutely nothing works. I'm gonna go bonkers.

CodePudding user response:

please Expose the port while you are running the image This command to deploy any docker image with exposing ports

docker run -p hostport:portinContainer imagetag 

In your case

docker run -p 8080:8080 docker.io/jenkins/jenkins:lts-jdk11
 ( or c1ae8e3564e4)

you can also use Docker compose, Kubernetes Deployment/Service etc to deploy too and going further in journey just docker run will not help need to adapt a deployment method Hope this v

  • Related