0

I am running a jenkins docker container and with in that I have installed docker. But when I try to run docker commands I get an error that the daemon is not turned on so I try the sudo systemctl start docker command and get the following error.

'System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down' error

Then I try the sudo service docker start command followed by sudo service docker status which then returns the following error.

'Docker is not running ... failed!'.

So I am not quite sure what to do going forward? Any ideas?

  • Do i understand right that you want to run docker inside a docker container?: Maybe this url can help you: https://stackoverflow.com/questions/27879713/is-it-ok-to-run-docker-from-inside-docker . It is also recommended to have a look inside the logfiles of docker. – Hannes Mar 01 '23 at 14:37
  • So I have a script in jenkins that ssh into an aws ec2 instance and then runs docker commands but the docker commands arent working as I am getting the daemon error. I am quite new to this so apologies if its coming across a bit unclear – Hassan Raza Mar 01 '23 at 14:40
  • Okay based on this i would say that you have a problem on your ec2 instance. – Hannes Mar 01 '23 at 14:42
  • hmmm I thought so. Thats why I opened the jenkins container's terminal in docker and tried to run the docker commands there and they didnt work so I thought that maybe the container has some configuration issues? – Hassan Raza Mar 01 '23 at 14:46
  • Yes, maybe. its hard to say without more informations. I recommend to have a look into the logs again and into the docker documentation. – Hannes Mar 01 '23 at 14:53
  • It's unusual to run a docker daemon inside a container. There is a concept of 'docker in docker', but that refers to having the docker cli installed in a container and communicating with the docker daemon on the host machine. Can you elaborate on what you're trying to achieve? – Hans Kilian Mar 01 '23 at 15:11
  • I am trying to develop a pipeline that connects to an aws ec2 instance and then sshs into the instance and then pulls the docker image from the docker hub and then runs that image. The docker commands for pulling the image and then running it arent working as it requires a docker daemon to be running and that is what I am having a problem with. :) – Hassan Raza Mar 01 '23 at 17:41

0 Answers0