Home > other >  Install Jenkins manually on docker image
Install Jenkins manually on docker image

Time:12-06

I'm trying to install/run jenkins manually without pulling the Jenkins image from the docker-hub

for this exercise I have used the ubuntu image container and I did the following:

  • Install jdk-11 on the container
  • Set up the JAVA_HOME env variable
  • Install jenkins with apt-get
  • Run jenkins with the command service jenkins start

then status output is the following

root@42024442b87b:/# service jenkins status
Correct java version found
Jenkins Automation Server is running with the pid 89

Now I don't now how to access the jenkins server running in the container from my host.

thanks in advance

CodePudding user response:

Docker containers are not reachable using the network from the host system by default. You need to expose a container's host, meaning that the port will be opened on the host machine and all traffic forwarded to the container.

Running docker with -p 8080:8080 forwards 8080. Take a look at the syntax here.

You can also specify which port on the host machine is supposed to be mapped to a container's port with something like -p 1234:8080.

You can also use the EXPOSE keyword in your Dockerfile.

  • Related