A-Stack in Docker Container
A-Stack can be started within the docker container. This section provides detailed steps to create docker image with A-Stack.
Prerequisites
Download and Install Docker for Enterprise
Docker Build Steps
- Ready of build TQL applications?
- Download A-Stack
- Develop models (or protocol extensions and Library functions (if any)).
- Upload A-Stack with auto-deployable models and application code to you local repository
- Create a Docker build file. The build file does the following -
- Gets Latest Ubuntu
- Installs JDK8 on Ubuntu
- Set any environment variables
- Download your build from local build repository.
- Note that the build must contain A-Stack Runtime (Prime, Configurator, or Regular).Â
- If the A-Stack Runtime is a Prime, make sure your models are included as part of the prime. Please refer to Exporting Projects section.
- Expose any ports
Sample Docker Build file is provided here below:
Dockerfile to build Container Image with A-Stack
# Docker Container with A-Stack # Based on ubuntu:14.04, installs A-Stack following the instructions from: # http://docs.atomiton.com/manual/tutorial/install-tqlengine-on-ubuntu/ FROM ubuntu:latest MAINTAINER Baseer Khan <bkhan@atomiton.com> # Installation: # JDK 8 is installed and running # Install Java. RUN \ echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ apt-get update && \ apt-get install -y unzip && \ apt-get install -y software-properties-common && \ add-apt-repository -y ppa:webupd8team/java && \ apt-get update && \ apt-get install -y oracle-java8-installer && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /var/cache/oracle-jdk8-installer # Define commonly used JAVA_HOME variable ENV JAVA_HOME /usr/lib/jvm/java-8-oracle ENV TQL_HOME /opt/myapp/latest/myappname # Download mynappname: RUN rm -rf /opt/myapp/latest RUN mkdir -p /opt/myapp/latest RUN wget -O /opt/myapp/latest/mynappname.zip http://xyz.com/myapp/mynappname.zip RUN unzip /opt/myap/latest/mynappname.zip -d /opt/myapp/latest EXPOSE 8080 EXPOSE 80 EXPOSE 443 WORKDIR /opt/myapp/latest/myappname
Useful Docker CLI Commands
List of Docker Images
docker images
List of Running Docker Containers
docker ps
Trigger a Build
From the local folder where Dockerfile is created run the command:
docker build --no-cache=true -t dockerid/myappname:mytagname .
Push the build to Docker Hub
docker push dockerid/myappname:mytagname
Start the Container
docker run -d -p 8080:8081 dockerid/myappname:mytagname java -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="`date`.hprof" -jar atomiton.tqlengine.jar
Stop the Container
docker stop <container id>
SSH into running Container
sudo docker exec -i -t 2b5541cc9e48 /bin/sh
2b5541cc9e48 is the Container ID; whose value can be retrieved using docker ps command.