alseambusher / crontab-ui

Easy and safe way to manage your crontab file
https://lifepluslinux.blogspot.com/2015/06/crontab-ui-easy-and-safe-way-to-manage.html
MIT License
2.79k stars 472 forks source link

Cannot connect to the Docker daemon #250

Open mridah opened 3 months ago

mridah commented 3 months ago

Make sure these boxes are checked( - [x] ) before submitting an issue.

I'm trying to execute the command

docker exec -it fireball bash /generate.sh test.json

image

However, I keep getting the following error :

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

image

I'm not running the cron job from the web portal so it shouldn't be a problem of docker not being installed on the crontab-ui docker container.

This is what I'm trying to achieve :

image

Any idea what might be causing the issue??

esbenboye commented 2 months ago

If you want to run a docker command on your "Crontab UI Container", you need to have Docker installed and running. The message you get indicates that this is not the case.

If you want to execute a script on the "another container", you would need to figure out a way for your Crontab UI Container to communicate with the "another container" to make it do whatever it should do (ssh tunnel, http request, queue producer/consumer .... Whatever suits your needs).

haat-reassured commented 2 weeks ago

From your error message I would infer that docker-cli at least is installed in your container? (Otherwise it would say Unknown command "docker"). I would expect you to need docker installed in the crontab-ui container for this to work. If you have docker, easiest way is to mount the host's /var/run/docker.sock to the crontab-ui container with -v /var/run/docker.sock:/var/run/docker.sock in the docker run command, or in docker-compose.yml:

  volumes:
    - /var/run/docker.sock:/var/run/docker.sock

That does give the crontab-ui container the ability to do anything with docker, tho, so make sure you've reviewed the source code.