Running AEM in Docker
Thinking to run AEM in container ?
The basic questions that strikes the mind
- Docker is designed for microservices
- AEM is a monolith
- Docker runs the best with stateless containers
- AEM has a big filesystem snapshot repository can be of the size of GB's
I started with creating a basic image which contains every thing within the container , one complete image which contains the image, bundles and repository.
Basically we have 2 use cases
1) For lower environments we can have every thing inside one container - Binaries and Content
2) For higher environment (UAT and Production) we need repository persistence
Solving the first use case is easy, use the basic image from the Here
The challenge is to achieve the repository persistence. And we were able to achieve it by using the concept of volumes .
We can use Docker data only containers, in which we create a volume from an image
docker create -v /<path-from-image> --name data-store <<aem_image>> /bin/true
what above command will do, is host the path from the image as a persisting volume as a container, even if we remove the image the volume still remains.
When you start your AEM container just use the command "volumes-from" to mount the repository from the data container
docker run -d --name=aem-author-instance --volumes-from repo-segment-store --volumes-from repo-data-store -p 6602:6602 aem_author_demo
Another way to achieve the repository persistence is using the host volumes
we can mount a directory on the docker host, and when we run the container it picks the path from the mount .
use the command to create the volume
docker create -v /aem/segmentstore name repo-segment-store aem_author /bin/true
and use the command to host the volume when starting the container
docker run -d -P --name aem-author-3 -v </home/ubuntu/datavolume/dockervolume/binarystore/segmentstore>:</adobe/segmentstore> -p 4502:4502 <test_volume>
So we can achieve both the use case using docker, and the advantages we get are very impressing
Environment setup time for a new person in team or recreating the environment for a urgent defect is just matter or seconds .
In production or UAT , we can spin around a new container on demand .
Taking this concept a little further if we combine this solution with an configuration system like "Ansible" and an orchestrating solutions like "kubernetes" the possibilities are unlimited, we can completely eliminate the issues related to environment and code progression from one environment to other .
In the next article I will post the solution for using AEM with Docker+kubernetes+Ansible , stay tuned .
At some point we will document how were using AWS EKS as well as EFS for both AEM6.5 and CQ5. We can look at open sourcing the charts if people will be interested.
I’m trying to implement 6.4 in docker now.
qq: is AEM same thing as the campaign mgr?
Did you ever get to write the AEM6 and kubernetes post?