Docker: run commands on host?
See original GitHub issueI found a version that runs on pi: donaldrich/crontab-ui
But when I add a simple command like: sudo apt-get update
, or apt-get update
I get errors saying sudo and apt-get don’t exist, so my assumption is it is only running these commands inside the container which is kinda useless I think; is there a way to run these commands on the host?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
How to run shell script on host from docker container?
IMO this is the best answer. Running arbitrary commands on the host machine MUST be done through some kind of API (e.g. REST)....
Read more >docker run - Docker Documentation
docker run : The `docker run` command first `creates` a writeable container layer over the specified image, and then `starts` it using the...
Read more >How to execute a command directly on the host system ...
The best way that I've found to execute commands on the underlying host with an exposed Docker socket is Ian Miell's most pointless...
Read more >How To Use docker exec to Run Commands in ... - DigitalOcean
To run a command as a different user inside your container, add the --user flag: docker exec --user guest container-name whoami.
Read more >How can I run a docker exec command inside a ... - Edureka
If you're running the containers on the same host then you can execute docker commands within the container. This can be done by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Updates:
Curiously. Editing my “root” crontab file seems to work… cron picked it up.
I mounted
/var/spool/cron/crontabs/
in my container, wrote the crontab with crontab-ui and then stopped the container (to ensure only host cron runs). It failed, as/etc/crontabs
didn’t exist (for logging), so all output was ditched. Created that, and then cron ran my command successfully. I found the env varCRON_PATHS
controls this path, so I’ve adjusted that to/var/spool...
In the end, I have:
docker-compose.yml
supervisord.conf
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.