This repository contains example cartridges and prototyping for Docker based cartridges in OpenShift. For more information about the design and implementation, see the Docker cartridges PEP.
The platform
directory contains a simple proof of concept implementation of a build
system which creates runnable Docker images from cartridge 'manifests' and source code for an app.
The cartridges
directory contains the Dockerfiles and manifests of several example
cartridges:
fedora-wildfly
and its builderfedora-wildfly-build
ubuntu-buildpack
fedora-mock
centos-ruby2
You can build a base image for a cartridge using the build
command:
sudo ./build <cartridge-name>
Once your cartridge image is built, you can prepare a gear image using the prepare
command:
sudo ./prepare <username> <cartridge-name> <path to source>
This will create a gear image with the tag <username>/<cartridge-name>-app
.
You can run a gear image with the run
command:
sudo ./run <username> <app-name> <cartridge-name>
This will run the gear image with the required ports bound to dynamically allocated ports on the host machine.
The cartridges
directory also contains a number of preliminary example "cartridges"
which are simply a Dockerfile (representing the base cartridge) and a cartridge.sh
script that pre-date the POC prepare script. They implement the following workflow:
- Build the cartridge into an image
- "Prepare" the cartridge by injecting the source and invoking a script to build/deploy the source
- Save that image as the gear image, suitable for deployment
- Start the image
There are several ruby examples - Ruby 1.8.7 and 2.0.0 on CentOS, and then a Heroku Ruby Buildpack example. Each of these uses the same source and provides the same running Ruby Rack application - but under the covers they're all doing different things to make that possible, and each can offer unique advantages.