Skip to content

Instantly share code, notes, and snippets.

@goldmann

goldmann/mail.md Secret

Last active August 29, 2015 14:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldmann/d38589ad919343ba30dd to your computer and use it in GitHub Desktop.
Save goldmann/d38589ad919343ba30dd to your computer and use it in GitHub Desktop.

Docker images for JBoss' projects

Here is the idea -- let's create Docker images for all our projects.

Docker?

Most probably you've already heard about Docker. If not -- Docker is a project to create, deliver and run predefined templates. Docker is based on the latest Linux kernel features to make the startup lighting fast and the footprint very low.

Take a look at the Docker introduction slides (shameless plug) or watch Alexander's presentation from DevConf 2014 to learn more.

The idea

The idea is basically to create Docker images for all JBoss' projects that have something to show. If you don't think it would make sense to your project you can skip it, of course.

All JBoss' images will be registered under the jboss name on index.docker.io. Example names: jboss/wildfly, jboss/torquebox and so on. You should expect to see something similar to what Fedora does.

All Dockerfiles used to create the images will be hosted on GitHub. For now I use my own account, but it'll be moved to something else later.

The repository will be added to Docker index as trusted builds meaning that every commit to the repository will trigger a new build of the image.

On the jboss.org website there will be a dedicated page that will show all available images and (short) instructions how to get it/run and where to get help.

Why I (as a project leader) should care about it?

Docker makes it easy to create a template (image) with the environment you want. This image can be shared with people on https://index.docker.io/ public registry. Public images are easily downloadable and can be launched on any Docker enabled system providing the same environment for all. We have the full control of what we run and what the configuration is. This is a great way of delivering images with our projects so people can play with them and make them familiar with the Docker ecosystem. On the other hand we could have a stable environment which can be used to debug issues with the projects.

How can I help?

Reach out to me at mgoldman@redhat.com. I'll be coordinating the work of creating the images. I can even prepare the images for you! There are few things that would be nice to collect before we start the conversation:

  1. Project details: name, website, docs location, etc.
  2. What do you want to show/highlight?
  3. Any specific configuration needs to be used?

Best practices

Below you can find a list of things that can make your image better:

  1. Make sure you do all steps that will change less frequently as early as possible (close to the top of the Dockerfile). One example is the system upgrade. This will make the build faster by allowing to reuse the cached results.
  2. Use CMD not ENTRYPOINT, this will make it easy to override the command at runtime.
  3. Prepare your project is such way that it's usable out of the box; start the service, make it reachable from the host.
  4. If you have anything to add, for example alternate of launching the container; create a README.md file. This will be copied to index.docker.io too making it easy to read also in on the image size. One example of such comment is the information on how to create a management user to use the administration console in WildFly.
  5. Once the image is online, follow your image site for comments, fedora/apache example: https://index.docker.io/u/fedora/apache/.
  6. Use the EXPOSE instruction for every port the user should care about, for example: 8080 and 9990 for WildFly.
  7. Please do not add any heavy files to the repository. You can add custom configuration files of course.
  8. Do not fear to create custom launch script to be used in CMD instruction.
  9. (optional) Try to use non-root account. It's a good practice to not use the (default) root account for running the service. Use the USER instruction to change it.

Example

I prepared an example based on the WildFly project: https://index.docker.io/u/goldmann/wildfly/. There you can see how it can look. The source is available in this repository: https://github.com/goldmann/jboss-dockerfiles/tree/master/wildfly.

Questions?

Mail me or use IRC; I created a #jboss-docker channel on Freenode.

Thanks!

--Marek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment