Step 1: Add the below scripts after the "FROM" command in the dockerfile.
RUN apt-get update && \
apt-get install -y unzip
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 unzip ApplicareSingleAgentLinux.zip
RUN ["rm", "-frv", "/usr/local/Applicare/ApplicareSingleAgentLinux.zip"]
WORKDIR /usr/local/Applicare
WORKDIR /usr/local/Applicare/wrapper/linux
RUN chmod +x install.sh
RUN ["/usr/local/Applicare/wrapper/linux/install.sh"]
Replace the below 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 update && \
apt-get install -y unzip
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 unzip ApplicareSingleAgentLinux.zip
RUN ["rm", "-frv", "/usr/local/Applicare/ApplicareSingleAgentLinux.zip"]
WORKDIR /usr/local/Applicare
WORKDIR /usr/local/Applicare/wrapper/linux
RUN chmod +x install.sh
RUN ["/usr/local/Applicare/wrapper/linux/install.sh"]
Step 2: Add server name while creating a docker container.
While creating the docker container add the server name to the environment variable using -e sname=<SERVERNAME> and start the container. Replace <SERVERNAME> with the name which we need to add the agent in Applicare. The <SERVERNAME> should be unique for different containers.
Example:
-e sname=tomcatcontainer
docker container run -it -d -p 8065:8080 --name container1 -e sname=tomcatcontainer 1a2
Comments
0 comments
Article is closed for comments.