Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Basic object that provides the default overrides for a plugin. More...
#include <PluginBase.h>
Public Member Functions | |
virtual bool | postConstruction (const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the rootfs has been created, but before the container is launched. More... | |
virtual bool | preStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container is setup, but before the init process is executed. More... | |
virtual bool | postStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container is started and the init process is now running. More... | |
virtual bool | postStop (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container has stopped. More... | |
virtual bool | preDestruction (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container. More... | |
Public Member Functions inherited from IDobbyPlugin | |
virtual std::string | name () const =0 |
Should return the name of the plugin, this is used to match against the json spec file used to create the container. More... | |
virtual unsigned | hookHints () const =0 |
Should return a bitfield of the hook points implemented by the plugin. More... | |
Additional Inherited Members | |
Public Types inherited from IDobbyPlugin | |
enum | HintFlags : unsigned { PostConstructionSync = (1 << 0) , PreStartSync = (1 << 1) , PostStartSync = (1 << 2) , PostStopSync = (1 << 3) , PreDestructionSync = (1 << 4) , PostConstructionAsync = (1 << 16) , PreStartAsync = (1 << 17) , PostStartAsync = (1 << 18) , PostStopAsync = (1 << 19) , PreDestructionAsync = (1 << 20) } |
Bit flags that should be returned by hookHints. More... | |
Basic object that provides the default overrides for a plugin.
This class just saves the plugins from having to implement hook functions that are not needed.
|
inlineoverridevirtual |
Hook function called after the rootfs has been created, but before the container is launched.
At this point you can setup mounts that the container will see as it hasn't yet created the namespaces. This is typically used to mount something that wouldn't be allowed inside a userns, then once mounted you can hook the prestart phase to move mount it into the container's namespace.
You can also hook this point to allow you to add extra environment variables or pass in additional file descriptors via the startupState class.
[in] | id | The string id of the container. |
[in] | startupState | A utility object with methods that allow you to tweak the parameters of the container before it is launched. |
[in] | rootfsPath | The absolute path to the rootfs of the container. |
[in] | jsonData | The json data from the spec file. |
Implements IDobbyPlugin.
Reimplemented in PerfettoPlugin, OpenCDMPlugin, MulticastSocketPlugin, and EthanLogPlugin.
|
inlineoverridevirtual |
Hook function called after the container is started and the init process is now running.
This hook is not particularly useful, although it can be used to inform clients that a container has started successifully.
[in] | id | The id of the container (string) |
[in] | pid | The pid of the init process in the container. |
[in] | rootfsPath | The absolute path to the rootfs. |
[in] | jsonData | The json data for the hook specified in the container spec file. |
Implements IDobbyPlugin.
|
inlineoverridevirtual |
Hook function called after the container has stopped.
[in] | id | The id of the container (string) |
[in] | rootfsPath | The absolute path to the rootfs. |
[in] | jsonData | The json data for the hook specified in the container spec file. |
Implements IDobbyPlugin.
|
inlineoverridevirtual |
Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container.
This hook is called at a very similar place to postStop, but it will be called even if the container failed to start (but as long as postConstruction was called).
[in] | id | The string id of the container. |
[in] | rootfsPath | The absolute path to the rootfs of the container. |
[in] | jsonData | The json data from the spec file. |
Implements IDobbyPlugin.
|
inlineoverridevirtual |
Hook function called after the container is setup, but before the init process is executed.
The hooks are run after the mounts are setup, but before we switch to the new root, so that the old root is still available in the hooks for any mount manipulations.
[in] | id | The string id of the container. |
[in] | pid | The pid owner of the namespace to enter, typically the pid of the process in the container. |
[in] | nsType | The type of the namespace to enter, see above. |
[in] | func | The actual function to execute. |
Implements IDobbyPlugin.
Reimplemented in EthanLogPlugin.