ofelia
ofelia copied to clipboard
Running ofelia when a container is stopped?
I know that this is probably a weird question and that is something more related to the host OS scheduler... anyways, would be possible use ofelia to just start a container?
There are a lot of Docker images which just starts, do their job (probabily using an entrypoint script)... and then... exit.
The main feature of Ofelia is the ability to execute commands directly on Docker containers. Using Docker's API Ofelia emulates the behavior of exec, be in able to run a command inside of a running container. Also you can run the command in a new container destroying it at the end of the execution.
or I'm missing what you're asking?
@gremo, can you explain your use-case in more detail? @kamko is right, ofelia is designed to start containers.
Or you mean to start a container without specifying the command so it starts with the default one, which was set when container was built?
Thank you both. Maybe it's my english, I'll try to explain better... or maybe I'm missing somethig.
Take a simple image (container) that starts, do it's job, and then quits. If I schedule to run something in the container, using ofelia, will it work even if the container is stopped (not running at the time ofelia runs the job)?
Hmmm... job-exec will not work, because it is impossible to exec into a stopped container. Docker will throw Error response from daemon: Container 1abc123 is not running.
but if it is one-off container then you can simply create new container every run?
I'm looking to do something like this as a workaround to https://github.com/mcuadros/ofelia/issues/70.
I have a one-off container that needs environment variables, volumes, and to be run on a schedule. It doesn't seem like Ofelia can do this at the moment. The closest I can see would be job-run, but that seems to require the container to be named exactly (so Docker labels aren't as useful), and to be a "service container".