Reputation: 179
I am trying to create a Jenkins image that will have Jenkins up running with all plugins installed skipping the installation wizard.
I am stuck in the last bit. When I try to start jenkins (last instruction of my Dockerfile) using "systemctl start jenkins" I got the followoing error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"systemctl start jenkins\": executable file not found in $PATH": unknown.
After checking https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container/ and https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/
I tried with :
ENTRYPOINT:["/sbin/init"]
The result was:
a container was running but the service was not up.
[manuel@master useCaseJenkins]$ docker container run --name jenkins -d -p 8081:8080 manrodri/jenkins_use_case
2272206cdb8ce9483adfdaf4cbba5299c7d337dbe1b1e96e99a19821abd328e4
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2272206cdb8c manrodri/jenkins_use_case "/sbin/init" 37 seconds ago Up 36 seconds 0.0.0.0:8081->8080/tcp jenkins
[manuel@master useCaseJenkins]$ curl http://localhost:8081
curl: (56) Recv failure: Connection reset by peer
the container logs don't show anything at all.
[manuel@master useCaseJenkins]$ docker container logs 2272206cdb8c
[manuel@master useCaseJenkins]$
I tried to run a simple httpd service in the same way as shown in the two sites I mentioned before with the same result. the container was running but nothing was up in port 80.
See my Dockerfile at https://github.com/manrodri/jenkinsUseCase/blob/master/Dockerfile
Upvotes: 0
Views: 1129
Reputation: 3271
You do not need to run systemd in a container in order to have service manager. That's what you really want. ;)
If you want to check out my docker-systemctl-replacement then you can also have a look at the docker-systemctl-images which have some examples for you. At work I am even running Jenkins with that script but it is bit more complicated in its configuration to be shown in public.
Upvotes: 0