With last week's release of Docker 0.7.1, OpenShift's road to adopting Docker has had a few minor obstacles removed - clearing the way for Docker support to arrive in the not-too-distant future. You may recall, just a few short months ago, Red Hat announced our intention to leverage Docker in OpenShift, delivering a more flexible model for assembling full application stacks.
Docker's 0.7.1 release was quietly announced by Solomon Hykes on Twitter without much fanfare:
For a sneak peak of the road ahead for OpenShift and Docker, check out the OpenShift Docker pep plan for the high level technical approaches that we've been discussing. We would love to hear your feedback.
Why Wait? Get Started Now
Now is a great time to start building out an ecosystem of custom Fedora docker images as another way to share all of your kick-ass OpenShift applications with the rest of the world! As we work toward a deeper integration with Docker, these images may eventually be able to run directly on OpenShift without modification.
Fedora 19 in the Docker Index
The Docker team has created a publicly accessible ranked index of Docker images that is searchable and to a certain extent 'ranked'. If you haven't checked out the new Docker registry of images you should do so now. You'll find a number of base Fedora 19 images that you can start using right away to build your own custom images contributed by mattdm.
A Typical Docker Build Process
To get started, install Docker then add a typical
Dockerfile to the root of an OpenShift application's source repo, making use of the Fedora 19 base image:
# Based on the Fedora image created by Matthew Miller.
# Install nodejs and npm packages.
RUN yum update -y
RUN yum install -y --skip-broken nodejs npm
# Clean up
RUN yum clean all
# Start a server listening on 8080 using nodejs
ADD . /src
RUN cd /src; npm install
CMD ["node", "/src/server.js"]
You can test the build by adding your index.docker.io account name to the following command:
sudo docker build -t YOUR_DOCKER_ACCOUNTNAME/fedora-nodejs-example .
Your result should be listed as the latest entry in this command's output:
sudo docker images
Once your image has been built, make sure it runs (adding your own Docker.io account name below):
sudo docker run -v /opt/scratch/docker/volumes/1:/data -p 8080 YOUR_DOCKER_ACCOUNTNAME/fedora-nodejs-example
You can share your customized system images with the world by uploading them to index.docker.io.
Just login, and push your image to the index:
sudo docker login
sudo docker push YOUR_DOCKER_ACCOUNTNAME/fedora-nodejs-example
The docker image index also allows you to connect your GitHub account and add a post-commit hook to your repository. This allows you trigger Docker builds that will automatically update your image in the docker index whenever you push a commit.
This makes keeping your docker images up-to-date with your latest code totally painless.
You can find more details here http://docs.docker.io/en/latest/use/workingwithrepository/
That's it for today. Be sure to let us know when you post a new custom docker image and to tag it with "F19"!