https://github.com/awslabs/oci-add-hooks

Add oci hooks to Docker

https://github.com/awslabs/oci-add-hooks

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.2%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Add oci hooks to Docker

Basic Info
  • Host: GitHub
  • Owner: awslabs
  • License: apache-2.0
  • Language: Go
  • Default Branch: master
  • Size: 24.4 KB
Statistics
  • Stars: 63
  • Watchers: 12
  • Forks: 19
  • Open Issues: 2
  • Releases: 0
Created over 7 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Code of conduct Codeowners

README.md

Oci Add Hooks

oci-add-hooks is an OCI runtime with the sole purpose of injecting OCI prestart, poststart, and poststop hooks into a container config.json before passing along to an OCI compatable runtime.

Usage

This runtime can be invoked by doing

oci-add-hooks \ --hook-config-path </path/to/hook/config> --runtime-path </path/to/oci/runtime> \ …\ [--bundle <path/to/bundle> \] … - hook-config-path is a json file that follows the format described here. - runtime-path is a path to an OCI runtime binary. - bundle,if present, specifies the path to the bundle directory.

With Docker

A few things need to be done to use oci-add-hooks with Docker. First modify /etc/docker/daemon.json to includ a "runtimes" section similiar to the following:

json { "runtimes": { "oci-add-hook": { "path": "oci-add-hooks", "runtimeArgs": ["--hook-config-path", "/path/to/config.json", "--runtime-path", "<path/to/oci/runtime>"] } } }

note: path here should either include this binaries name when it's on the path or the full path/name if it's not.

If we had a hypothetical hook config located at /home/user/hook-config.json

json { "hooks": { "prestart": [ { "path": "path/to/prestart/hook", "args": ["hook", "some", "args", "here"] } ] } }

and we wanted to launch containers with runc our /etc/docker/daemon.json would look like:

json { "runtimes": { "oci-add-hooks": { "path": "oci-add-hooks", "runtimeArgs": ["--hook-config-path", "/home/user/hook-config.json", "--runtime-path", "runc"] } } }

This is assuming that both oci-add-hooks and runc are in the path. You can restart Docker to trigger a reload of this config file. You should be able to verify it has this runtime by doing docker info and seeing something like:

… Runtimes: oci-add-hooks runc …

Once this is setup you can use this runtime (and the configured hooks) by doing a docker run command and adding the --runtime=oci-add-hooks flag. docker run --rm --runtime=oci-add-hooks <image>

What is it doing

When invoked as above, oci-add-hooks will parse the file specified by hook-config-path as specified in the runtime-spec section on POSIX-platform hooks. It will merge these hooks into the config.json file located at the path passed to bundle, writing the changes back to disk. If hooks are already present in the spec, it will pre-pend these hooks to the existing ones. It will then strip out the options and args that are specific to oci-add-hooks and passthrough to the binary pointed at by runtime-path.

License

This library is licensed under the Apache 2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Watch event: 3
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 4
  • Fork event: 3
  • Create event: 2
Last Year
  • Watch event: 3
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 4
  • Fork event: 3
  • Create event: 2

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 6
  • Total pull requests: 11
  • Average time to close issues: 15 days
  • Average time to close pull requests: 12 days
  • Total issue authors: 5
  • Total pull request authors: 8
  • Average comments per issue: 3.33
  • Average comments per pull request: 0.55
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 10 minutes
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • aki-k (2)
  • scottblack1 (1)
  • Calderweis (1)
  • 486zzx (1)
  • therc (1)
Pull Request Authors
  • IRCody (4)
  • austinvazquez (1)
  • dependabot[bot] (1)
  • therc (1)
  • binchenX (1)
  • peng-yq (1)
  • aarongoulet (1)
  • solarkennedy (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
enhancement (1) dependencies (1) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
proxy.golang.org: github.com/awslabs/oci-add-hooks
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 3.5%
Stargazers count: 3.5%
Average: 5.8%
Dependent packages count: 7.0%
Dependent repos count: 9.3%
Last synced: 10 months ago

Dependencies

go.mod go
  • github.com/bitly/go-simplejson v0.5.0
  • github.com/joeshaw/json-lossless v0.0.0-20181204200226-e0cd1ca6349b
go.sum go
  • github.com/bitly/go-simplejson v0.5.0
  • github.com/joeshaw/json-lossless v0.0.0-20181204200226-e0cd1ca6349b