You are here
Home > AEM > AEM ON DOCKER

AEM ON DOCKER

AEM-on-Docker

AEM ON DOCKER

In this article we are going to work out on how to install AEM instance on docker container.  Less Docker knowledge is required.  (all commands with screenshot been attached).

We are setting up 1 author and 1 publishers (2 Containers with Same image)  and connect the instances.

Prerequisites:

1.Ensure latest Docker version up and running.

2.AEM Jar and license file .

3.Docker repository access to pull images.  If not please Register in https://hub.docker.com/

My Laptop Configuration :

1.Base OS : Ubuntu with 8 GB RAM.

2.Docker 1.18

Steps :

1.First ensure to start Docker service. In my case I have added in /etc/init.d so Docker get started when I starts my Base OS.

I have not covered some advanced concepts like supervisord , docker compose and Volume binding. Will write article on each in near future.

  • Commands:

> service docker start # Start if not added in startup .

Service docker status # confirm Docker status

AEM ON DOCKER

2.Login to Docker repo and check for the right image . I have tried to get Redhat official images and not able to find any official image. In this we have used FEDORA official verison.

NOTE: Always opt to get official images if you are planning for any Agile platform.

  • Commands:

docker pull fedora # docker pull the latest images from Docker repo.

AEM ON DOCKER

AEM ON DOCKER

In the above command  , docker pulls the latest and save the image. In my case I have already installed and named as fedora/aem . In the below screenshots you would seen as same , ( you need to give the exact image name with tag while you execute)

  • Commands

docker images  # Ensure you find your latest downloaded image.

Run the Docker image:

Once you ran Docker image command , Run image to create our container . Images are read only layer and we need to create container to install/ran service on top of image layer.

  • Commands 
Docker run -i -t <imagename > /bin/bash

I = interactive mode

T = tty terminal

/bin/bash = Shell to access container .

AEM ON DOCKER

Check the docker Process from other terminal window .

NOTE : Docker commands will not execute inside containers.

  • Commands

Docker ps # To get to know the status of container.

Install JAVA :

1.In your container , install latest JAVA or move the stable version from Local filesystem to container.

In this case , we install latest java from YUM repository.  Since I have the latest it not installed Java for me.

  • Commands
Yum update   # Fedora and redhat uses Yum . First update your repository

Yum install java-1.8.0-openjdk

Yum install java-1.8.0-openjdk-devel

AEM ON DOCKER

Once java installed , please run Java -version to get whether JAVA installed successfully.

AEM ON DOCKER

If not running , add the JAVA path to System variables.

For example : If you install java on /opt folder in Container. Execute the below commands

export JAVA_HOME=/opt/jdk1.8.0_171
export JRE_HOME=/opt/jdk1.8.0_171/jre
export PATH=$PATH:/opt/jdk1.8.0_171/bin:/opt/jdk1.8.0_171/jre/bin

Mandatory tools to install:

Once Java installed , we need to install few basic tools

  • Commands
                              Yum install net-tools # Ip commnd will get installed by this command

Yum install procps   # Ps commnd will get installed by command.

NOTE : Since I have this already installed, so I have skipped it .

AEM ON DOCKER

Install AEM and License file via Docker cp command:

Dockr cp is used to copy files from Local to Container and Vice versa. This can also be achieved using Docker Volume . Run this command from outside of your container.

  • Command

 

Docker cp <SourcePath> <containerID>/<Destinationpath>

Cp – Copy  command

<Sourcepath>  : Localfile path with File name

<ContainerID> : Container in which you need to transfer it. In our case it is <b9e0cee23ba0>

<Destinationpath> : Container path to store the file.

Commit all changes ( Important step) 

Docker commit is used to save the changes which you have made . Else all the installation/services been made will be lost.

As I informed earlier Docker command wont work inside container. Open New terminal and type the below command.

Ø  Command

Docker commit -m=”comments/modification” <containerID> <User-defined-name>

-m = type the changes <containerID> = ID of container <User-defined-name> = User defined name for the New image.

Docker images # this command will show your new Image.

AEM ON DOCKER

Start the New image using Docker Run command.

Ø  Command

Docker run -t -i <imagename>:<tagname>

AEM ON DOCKER

Docker ps # to get the latest container details.

Docker exec -ti <containername> /bin/bash  # Login to container and start AEM Process in Background. Once done, please exit the below container . Java process should run in background .

AEM ON DOCKER

Docker Network :

To run the AEM application , you need to get the IP for this container .

Ø  Command

Docker network inspect bridge  # We have 3 types of network and will be covered in next article.

We need to grep IPv4Address and type in Browser.

AEM ON DOCKER

In Browser , type 172.17.0.2:4502/crx/de to start  AEM Author.

Docker Network Issue:

If you stop and start the same image again , the IPs would change and due to this reason we need to create own network and assign static Ips to that container.

NOTE : ALL below commands should be executed from your local terminal (not insider container shell )

Ø  Command

Docker network create –subnet=<Subnet values> <yournetworkname >

AEM ON DOCKER

Docker run –net <yournetworkname> --ip <static ip> -it <imagename> /bash

AEM ON DOCKER

Docker network inspect <yournetworkname>

AEM ON DOCKER

Output :

AEM ON DOCKER

NOTE: Since I have 2 containers started I can see 2 containers details.

Container 1 : 172.18.0.23

Container 2 : 172.18.0.20

All the IPs can be mapped within subnet range we created.

Inspect your running containers:

If you still need to inspect your container run the below command

Ø  Command

Docker container inspect <containerID>

AEM ON DOCKER

AEM ON DOCKER

Check for static IP address which is assigned to this container as we have 2 containers.

Start AEM with specified static IP on Browser:

NOTE : Here I am shown steps to install  AEM author . Take same image , Start container , change PORT and Hostname in Startup script and exec start command in background.

AEM author screenshot:

AEM ON DOCKER

AEM Publisher screenshot:

AEM ON DOCKER

Configure Forward replication and ensure content transfer.
In the below screenshot , added Publisher Ip and make test connection.

AEM ON DOCKER

Please reach out to us, if you need any more info.

DevopsCracks
AEM ON DOCKER
Restore AEM Using Journal Log
AEM ON DOCKER
This article describes about how to restore our AEM application with our last good working revision using the Journal log.
In this article we are going to work out on how to install AEM instance on docker container. Less Docker knowledge is required.

4 thoughts on “AEM ON DOCKER

  1. Will be useful in Agile model. Any latest PROD environment could be import to local filepath as images . If your developers crashed your TEST env, we can replace with this images.

    Also this imported images can be exported to any Docker systems and this will be useful to expand instances on demand basis.

  2. Good website! I really love how it is easy on my eyes and the data are well written. I’m wondering how I could be notified whenever a new post has been made. I’ve subscribed to your feed which must do the trick! Have a nice day!

Leave a Reply

Top