|go ahead... be a heretic
trippledubs's scratchpadby trippledubs (Deacon)
|on Jul 04, 2012 at 15:21 UTC
What is a Docker? What is a container?
A container is an isolated lightweight environment to run an application. Docker is a platform that features commands and infrastructure for provisioning containers with usable applications. It has a cpan like repository of base images. Docker Hub hosts an official perl image based on Debian that works great and begins with perl and cpanm installed.
Creating a test application to containerize
Using Carton to handle CPAN dependencies
Create a file named 'cpanfile'.
Containerizing perl application
The image is built from a file 'dockerfile'. Each line is a layer in the image. The more static the content, the higher in the dockerfile it should be to utililze caching. For instance, in the below dockerfile, if 'cpanfile' changes, the new file is copied and all subsequent lines in the docker file are re-ran instead of pulled from cache. If alpine:latest on docker hub changes, being the first line, the whole image is rebuilt without cache. Alpine Linux is a popular choice for the first step in building containers because it is extremely small, coming in at 5mb.
Commands to run