Skip to content

Latest commit

 

History

History
158 lines (103 loc) · 6.1 KB

README.md

File metadata and controls

158 lines (103 loc) · 6.1 KB


Containerbay

Web gateway for OCI artifacts

license go report card


Container images gateway browser and indexer
Website static server - Reverse Container image browser

Containerbay allows to serve OCI container artifacts as static websites and browse them from curl or your browser. Works also with MagicDNS(tm).

📓 Example

curl https://containerbay.io/ghcr.io/containerbay/containerbay.io:latest/

Some notable examples that you can just browse right away:

If there is no index page, it will fallback to list all the present files, so it can be used to browse also already existing container images content

💻 Usage

Containerbay can be used to explore container images with curl, but can also be used to bind static domain, or run standalone servers that bind to a single image reference

API

Point your browser or either curl to access the container's content in this form host/registry/org/image_name:tag/, the host should be pointed to a containerbay instance ( like containerbay.io ):

curl https://containerbay.io/docker.io/opensuse/leap/etc/os-release
curl https://containerbay.io/docker.io/opensuse/leap@sha256:b603e69d71c9d9b3ec1fcd89d2db2f3c82d757e8a724a8602d6514dc4c77b1cb/

MagicDNS(tm)

When Containerbay is running, it accepts container images from subdomains in the following format registry.org.image_name.tag.magicdns.io

For example, by using containerbay.io

curl http://docker.io.library.alpine.latest.containerbay.io/etc/os-release

will return /etc/os-release from alpine:latest.

Bind to a custom domain

Containerbay can associate a custom domain to a container image. In this way you can have images containing static HTML files and use it to serve a subdomain or a top level dns. See as an example repository.

Point your DNS to the containerbay instance via A or CNAME and add a corresponding TXT record.

In the TXT record, write the image you want to serve:

containerbay=library/alpine:latest

Serve a static website

Containerbay can be used to deploy static website.

There is available a pack command which is a helper in order to create tar archives from files that can be loaded from docker in order to be pushed over a registry, for instance, if you have a folder with a index.html:

# Create output.tar, and include api/public/index.html. We will name the container image will be  ghcr.io/containerbay/containerbay.io:latest
containerbay pack --destination output.tar ghcr.io/containerbay/containerbay.io:latest api/public/index.html
# Load the image to the docker daemon
docker load -i output.tar
# Push the container image
docker push ghcr.io/containerbay/containerbay.io:latest

containerbay pack accepts a destination output with the --destination flag, first argument is the container image

Alternatively you can also just use docker, or podman or your favorite container builder, check the website folder for an example.

🏃 Deploy

Containerbay is currently a service deployed at containerbay.io.

You can although choose to deploy containerbay locally, using Docker or Kubernetes.

Docker

You can run containerbay with:

docker run -p 80:8080 \
           -e CONTAINERBAY_LISTENADDR=:8080 \
           -e CONTAINERBAY_MAGICDNS= \
           -e CONTAINERBAY_MAXSIZE=100MB \
           -e CONTAINERBAY_CLEANUPINTERVAL=1h \
           -ti --restart=always --name containerbay ghcr.io/containerbay/containerbay run

The API endpoint will be accessible at localhost:80

Kubernetes

There is a sample deployment file in kube. Edit the ingress definition to fit your needs, there is also a traefik example configuration file for a wildcard DNS setup (magicDNS*)

Locally

As containerbay is a static binary, you can just download the binary from the releases and run it locally.

Containerbay from the CLI can run as a proxy for multiple images, or run standalone to point only to a specific image/tag.

There is also available a pack subcommand as utility to create docker-loadable images from folders and directories.

Run standalone mode

Containerbay can also be used to serve a single container image reference only, for instance:

containerbay standalone <image/reference:tag>

Will start the API server serving the image on the default port (8080).

Caveats

DockerHub applies pull rate limits to manifest fetching, containerbay could hit those limit depending on the service usage. Other container registries like e.g. quay.io don't have such limitations.

Support containerbay.io

Currently containerbay is hosted merely on my own expenses, if you rely on this service, consider to donate or sponsor hosting for this service!

Author

Ettore Di Giacinto

Credits

Icons made by Freepik from www.flaticon.com

License

GPL-3