To install Applicare SingleAgent in docker container, add the below script based on the OS after the "FROM" command to the dockerfile.
CentOS
RUN apt-get install unzip -y RUN mkdir /usr/local/Applicare WORKDIR /usr/local/Applicare RUN curl CONTROLLER_PROTOCOL://CONTROLLER_IP:CONTROLLER_PORT/applicare/standalone?filename=ApplicareSingleAgentLinux.zip >ApplicareSingleAgentLinux.zip RUN chmod -R 777 /usr/local/Applicare RUN unzip ApplicareSingleAgentLinux.zip RUN chmod -R g=x+r /usr/local/Applicare RUN ["rm", "-frv", "/usr/local/Applicare/ApplicareSingleAgentLinux.zip"] WORKDIR /usr/local/Applicare RUN chmod -R 777 /usr/local/Applicare WORKDIR /usr/local/Applicare/wrapper/linux RUN chmod +x install.sh RUN ["/usr/local/Applicare/wrapper/linux/install.sh"]
Replace the following values in the above script
CONTROLLER_PROTOCOL -> http (or) https
CONTROLLER_IP -> Applicare Controller IP
CONTROLLER_PORT -> Applicare Controller Port
Example:
FROM tomcat:8
RUN apt-get install unzip -y
RUN mkdir /usr/local/Applicare
WORKDIR /usr/local/Applicare
RUN curl http://127.0.0.1:8880/applicare/standalone?filename=ApplicareSingleAgentLinux.zip >ApplicareSingleAgentLinux.zip
RUN chmod -R 777 /usr/local/Applicare
RUN unzip ApplicareSingleAgentLinux.zip
RUN chmod -R g=x+r /usr/local/Applicare
RUN ["rm", "-frv", "/usr/local/Applicare/ApplicareSingleAgentLinux.zip"]
WORKDIR /usr/local/Applicare
RUN chmod -R 777 /usr/local/Applicare
WORKDIR /usr/local/Applicare/wrapper/linux
RUN chmod +x install.sh
RUN ["/usr/local/Applicare/wrapper/linux/install.sh"]
DebianOS
RUN yum install unzip -y RUN mkdir /usr/local/Applicare WORKDIR /usr/local/Applicare RUN curl CONTROLLER_PROTOCOL://CONTROLLER_IP:CONTROLLER_PORT/applicare/standalone?filename=ApplicareSingleAgentLinux.zip >ApplicareSingleAgentLinux.zip RUN chmod -R 777 /usr/local/Applicare RUN unzip ApplicareSingleAgentLinux.zip RUN chmod -R g=x+r /usr/local/Applicare RUN ["rm", "-frv", "/usr/local/Applicare/ApplicareSingleAgentLinux.zip"] WORKDIR /usr/local/Applicare RUN chmod -R 777 /usr/local/Applicare WORKDIR /usr/local/Applicare/wrapper/linux RUN chmod +x install.sh RUN ["/usr/local/Applicare/wrapper/linux/install.sh"]
Replace the following values in the above script
CONTROLLER_PROTOCOL -> http (or) https
CONTROLLER_IP -> Applicare Controller IP
CONTROLLER_PORT -> Applicare Controller Port
Example:
FROM tomcat:8
RUN yum install unzip -y
RUN mkdir /usr/local/Applicare
WORKDIR /usr/local/Applicare
RUN curl http://127.0.0.1:8880/applicare/standalone?filename=ApplicareSingleAgentLinux.zip >ApplicareSingleAgentLinux.zip
RUN chmod -R 777 /usr/local/Applicare
RUN unzip ApplicareSingleAgentLinux.zip
RUN chmod -R g=x+r /usr/local/Applicare
RUN ["rm", "-frv", "/usr/local/Applicare/ApplicareSingleAgentLinux.zip"]
WORKDIR /usr/local/Applicare
RUN chmod -R 777 /usr/local/Applicare
WORKDIR /usr/local/Applicare/wrapper/linux
RUN chmod +x install.sh
RUN ["/usr/local/Applicare/wrapper/linux/install.sh"]
Creating a docker container
While creating the docker container either add the custom server name to the environment variable using -e sname=<SERVERNAME> or add the container name to the environment variable using -e cname=<CONTAINERNAME> and start the container. Replace <SERVERNAME> with the server name or replace <CONTAINERNAME> with the container name which we need to add the agent in Applicare.
Example:
-e sname=tomcatServercontainer docker container run -it -d -p 8065:8080 --name container1 -e sname=tomcatServercontainer 1a28b359235a
(or)
-e cname=container1 docker container run -it -d -p 8065:8080 --name container1 -e cname=container1 1a28b359235a