I know that there’s an image available ready for Jenkins, but I’m trying to build a Dockerfile to run Jenkins in a container, as I’m still learning the fundamentals of Docker and Jenkins.
I tried to build a container image with Dockerfile, but there’s still something going missing. So far, this is what I got in my Dockerfile:
Dockerfile for creating an image called: jorgemauriciodev/dev-docker-ubuntu-v1:
# Image.
FROM ubuntu
# Update repository.
RUN apt-get update
# Set timezone.
RUN apt install tzdata -y
ENV TZ="America/New_York"
# Install softwares.
# wget.
RUN apt-get install wget - y
# gnupg.
RUN apt-get install -y gnupg
# Install jenkins.
RUN apt-get install default-jdk - y
# Install apache2.
RUN apt-get install apache2 - y
# Donwload package.
RUN wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
#RUN sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
#Outdated info.
RUN sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
RUN apt-get update
RUN apt-get install jenkins –y
And my idea to run the image created with the Docker file, would be (CMD terminal):
sudo docker run -it -d -p 8080: 8080 jorgemauriciodev/ubuntu-docker-jenkins-dev-v1 bash
After up and running, my intention would be to access through a http address, like so:
http://123.123.123.123:8080/
I think there are lines missing in the Dockerfile to initialize Jekins service, besides other details that because of my low experience with Docker and Jenkins, I don’t know about. Can anyone try to point me lines / configurations that are missing so I can get this going?