Sunday, April 12, 2026

Install Jenkins via Docker and setup access via ssh

 


Install Jenkins via Docker 


dave@fedora:/git/devops-docker$ sudo docker run --name jenkins-test -p 8080:8080 -p 50000:50000 -d jenkins/jenkins:lts
[sudo] password for dave: 
Unable to find image 'jenkins/jenkins:lts' locally
lts: Pulling from jenkins/jenkins
53c88f1dfeb7: Pull complete 
4d2125ccf71c: Pull complete 
69503609dc01: Pull complete 
6da7907f70f4: Pull complete 
6327a7366a6f: Pull complete 
01938f7c040b: Pull complete 
b7b154fd69a1: Pull complete 
876217fdee20: Pull complete 
fbae626c1b7a: Pull complete 
b19825c62ed8: Pull complete 
ec7478903548: Pull complete 
e682a95ad036: Pull complete 
Digest: sha256:c4098086090ca98491d4bf66182f5e3b015a8232f2acf2df209a212a5801aa8e
Status: Downloaded newer image for jenkins/jenkins:lts
16c87f857d22f7a0be645a6a1cd88633bfef9b381a03c9061ad723acc4acc33c


Get admin password 

dave@fedora:/git/devops-docker$ sudo docker logs jenkins-test
Running from: /usr/share/jenkins/jenkins.war
webroot: /var/jenkins_home/war
2026-04-12 13:46:37.724+0000 [id=1]    INFO    winstone.Logger#logInternal: Beginning extraction from war file
2026-04-12 13:46:38.325+0000 [id=1]    WARNING    o.e.j.ee9.nested.ContextHandler#setContextPath: Empty contextPath
2026-04-12 13:46:38.359+0000 [id=1]    INFO    org.eclipse.jetty.server.Server#doStart: jetty-12.1.5; built: 2025-12-03T22:18:24.732Z; git: 4905d09d7b6801e792d7b73946cf7b66e4be25d6; jvm 21.0.9+10-LTS
2026-04-12 13:46:38.654+0000 [id=1]    INFO    o.e.j.e.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.ee9.jsp.JettyJspServlet
2026-04-12 13:46:38.699+0000 [id=1]    INFO    o.e.j.s.DefaultSessionIdManager#doStart: Session workerName=node0
2026-04-12 13:46:38.909+0000 [id=1]    INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2026-04-12 13:46:38.979+0000 [id=1]    INFO    o.e.j.s.handler.ContextHandler#doStart: Started oeje9n.ContextHandler$CoreContextHandler@3681037{Jenkins v2.541.3,/,b=file:///var/jenkins_home/war/,a=AVAILABLE,h=oeje9n.ContextHandler$CoreContextHandler$CoreToNestedHandler@2459319c{STARTED}}
2026-04-12 13:46:38.990+0000 [id=1]    INFO    o.e.j.server.AbstractConnector#doStart: Started oejs.ServerConnector@2aa6311a{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2026-04-12 13:46:38.991+0000 [id=1]    INFO    org.eclipse.jetty.server.Server#doStart: Started oejs.Server@78525ef9{STARTING}[12.1.5,sto=0] @633ms
2026-04-12 13:46:38.992+0000 [id=43]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2026-04-12 13:46:39.073+0000 [id=42]    INFO    jenkins.model.Jenkins#<init>: Starting version 2.541.3
2026-04-12 13:46:39.122+0000 [id=51]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2026-04-12 13:46:39.132+0000 [id=72]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2026-04-12 13:46:39.707+0000 [id=51]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2026-04-12 13:46:39.711+0000 [id=51]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2026-04-12 13:46:39.712+0000 [id=68]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2026-04-12 13:46:39.837+0000 [id=52]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2026-04-12 13:46:39.837+0000 [id=59]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2026-04-12 13:46:39.838+0000 [id=69]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2026-04-12 13:46:39.839+0000 [id=69]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2026-04-12 13:46:39.857+0000 [id=86]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2026-04-12 13:46:40.152+0000 [id=63]    INFO    jenkins.install.SetupWizard#init: 
[LF]> 
[LF]> *************************************************************
[LF]> *************************************************************
[LF]> *************************************************************
[LF]> 
[LF]> Jenkins initial setup is required. An admin user has been created and a password generated.
[LF]> Please use the following password to proceed to installation:
[LF]> 
[LF]> 3c54093a66f94103af3594c3851f070a
[LF]> 
[LF]> This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
[LF]> 
[LF]> *************************************************************
[LF]> *************************************************************
[LF]> *************************************************************

2026-04-12 13:46:46.027+0000 [id=65]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2026-04-12 13:46:46.042+0000 [id=42]    INFO    hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running
2026-04-12 13:46:47.011+0000 [id=86]    INFO    h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
2026-04-12 13:46:47.011+0000 [id=86]    INFO    hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1

Install plugins Install SSH server plugin Access Jenkins via ssh




dave@fedora:/git/devops-docker$ ssh -p 2222 dave@localhost help
  add-job-to-view
    Adds jobs to view.
  build
    Builds a job, and optionally waits until its completion.
  cancel-quiet-down
    Cancel the effect of the "quiet-down" command.
  clear-queue
    Clears the build queue.
  connect-node
    Reconnect to a node(s)
  console
    Retrieves console output of a build.
  copy-job
    Copies a job.
  create-credentials-by-xml
    Create Credential by XML
  create-credentials-domain-by-xml
    Create Credentials Domain by XML
  create-job
    Creates a new job by reading stdin as a configuration XML file.
  create-node
    Creates a new node by reading stdin as a XML configuration.
  create-view
    Creates a new view by reading stdin as a XML configuration.
  declarative-linter
    Validate a Jenkinsfile containing a Declarative Pipeline
  delete-builds
    Deletes build record(s).
  delete-credentials
    Delete a Credential
  delete-credentials-domain
    Delete a Credentials Domain
  delete-job
    Deletes job(s).
  delete-node
    Deletes node(s)
  delete-view
    Deletes view(s).
  disable-job
    Disables a job.
  disable-plugin
    Disable one or more installed plugins.
  disconnect-node
    Disconnects from a node.
  enable-job
    Enables a job.
  enable-plugin
    Enables one or more installed plugins transitively.
  get-credentials-as-xml
    Get a Credentials as XML (secrets redacted)
  get-credentials-domain-as-xml
    Get a Credentials Domain as XML
  get-gradle
    List available gradle installations
  get-job
    Dumps the job definition XML to stdout.
  get-node
    Dumps the node definition XML to stdout.
  get-view
    Dumps the view definition XML to stdout.
  groovy
    Executes the specified Groovy script. 
  groovysh
    Runs an interactive groovy shell.
  help
    Lists all the available commands or a detailed description of single command.
  import-credentials-as-xml
    Import credentials as XML. The output of "list-credentials-as-xml" can be used as input here as is, the only needed change is to set the actual Secrets which are redacted in the output.
  install-plugin
    Installs a plugin either from a file, an URL, or from update center. 
  keep-build
    Mark the build to keep the build forever.
  list-changes
    Dumps the changelog for the specified build(s).
  list-credentials
    Lists the Credentials in a specific Store
  list-credentials-as-xml
    Export credentials as XML. The output of this command can be used as input for "import-credentials-as-xml" as is, the only needed change is to set the actual Secrets which are redacted in the output.
  list-credentials-context-resolvers
    List Credentials Context Resolvers
  list-credentials-providers
    List Credentials Providers
  list-jobs
    Lists all jobs in a specific view or item group.
  list-plugins
    Outputs a list of installed plugins.
  mail
    Reads stdin and sends that out as an e-mail.
  offline-node
    Stop using a node for performing builds temporarily, until the next "online-node" command.
  online-node
    Resume using a node for performing builds, to cancel out the earlier "offline-node" command.
  quiet-down
    Quiet down Jenkins, in preparation for a restart. Don’t start any builds.
  reload-configuration
    Discard all the loaded data in memory and reload everything from file system. Useful when you modified config files directly on disk.
  reload-job
    Reload job(s)
  remove-job-from-view
    Removes jobs from view.
  replay-pipeline
    Replay a Pipeline build with edited script taken from standard input
  restart
    Restart Jenkins.
  restart-from-stage
    Restart a completed Declarative Pipeline build from a given stage.
  safe-restart
    Safe Restart Jenkins. Don’t start any builds.
  safe-shutdown
    Puts Jenkins into the quiet mode, wait for existing builds to be completed, and then shut down Jenkins.
  session-id
    Outputs the session ID, which changes every time Jenkins restarts.
  set-build-description
    Sets the description of a build.
  set-build-display-name
    Sets the displayName of a build.
  shutdown
    Immediately shuts down Jenkins server.
  stop-builds
    Stop all running builds for job(s)
  update-credentials-by-xml
    Update Credentials by XML
  update-credentials-domain-by-xml
    Update Credentials Domain by XML
  update-job
    Updates the job definition XML from stdin. The opposite of the get-job command.
  update-node
    Updates the node definition XML from stdin. The opposite of the get-node command.
  update-view
    Updates the view definition XML from stdin. The opposite of the get-view command.
  version
    Outputs the current version.
  wait-node-offline
    Wait for a node to become offline.
  wait-node-online
    Wait for a node to become online.
  who-am-i
    Reports your credential and permissions.
dave@fedora:/git/devops-docker$ 


Run job via ssh 




Trigger a build and follow the logs (Best for Dev):
ssh -p 2222 my_jenkins_user@localhost build "Your-Job-Name" -s -v

No comments:

Post a Comment