Using the IABookstore Sample for Creating Docker Containers

InstallAnywhere 2022

The IABookStore is a free-to-use J2EE sample along with its corresponding InstallAnywhere project that is shipped along with InstallAnywhere to help you explore the functionality of docker containers (as well as virtual appliances).

IABookstore Sample

Resource

Location

Location of the InstallAnywhere project for IABookStore application

$IA_HOME$/IABookStore

Location of the web archive (.war) file for the IABookStore application

$IA_HOME$/IABookStore/data/IABookStore.war

Location of the dockerbuild_supporting_file startupscript.sh for the IABookStore Application

$IA_HOME$/IABookstore/dockerbuild_supporting_files/startupscript.sh

Location of the Dockerfile to build the IABookStore

$IA_HOME$/IABookstore/Dockerfile_Default_Container_Configuration/Dockerfile

Note:Before you open the IABookStore project for building its docker container, you need to copy the Linux JDK 6 VM pack to the $IA_HOME$\resource\installer_vms directory. You also need to make sure that the VM pack is compatible with the architecture of the docker image on which it will be installed. You can download this VM pack from the Revenera Web site (https://www.revenera.com/install/products/installanywhere/installanywhere-files-utilities.html). First click Linux Intel (x86) and then download Sun JRE 1.6.0_26 Linux (32-bit) INTEL.

Important:It is recommended that you do not open the startupscript.sh file in an unsupported file editor because those editors add extra junk characters to the script file, which often leads to corruption of the file.

To use this sample to create docker containers, perform the following steps.

To use this sample to create docker containers:

1. Open the InstallAnywhere project.
2. Navigate to the Build Containers view of the Build page.
3. Change the Container Name to IAbookstore.
4. Under Docker Engine, provide the credentials of the Docker engine on which you want to build the IABookStore container.
5. Use the Search and Pull an Image from Docker Registry dialog box to search for and then pull an ubuntu:latest base image to your Docker engine. To learn more, see Search and Pull an Image from Docker Registry Dialog Box.

Once you have selected an image to pull, InstallAnywhere pulls it to your Docker engine.

6. Under Select Base Image, select a valid base image from the same Docker engine to build the container from. Click the Refresh button to display the list of images.
7. Review the installer of your IABookStore application by clicking Add/Remove in the Setups to Install field.
8. Review the corresponding Dockerfile that is created. Below is the sample of a Dockerfile for the application.

------------------------------------------------------------------------------------------

#This Dockerfile is created through InstallAnywhere

#------------------<<Docker Image>>------------------

From ubuntu:latest

#------------------<<Docker Image>>------------------

#------------------<<Installers added to the Docker container>>------------------

ADD $IA_PROJECT_DIR$\IABookStore_Build_Output\Default_Configuration\Web_Installers\InstData\
      Linux\VM\install.bin /

RUN chmod ugo+x /install.bin ; sleep 1 ; ./install.bin -i silent ; rm -rf /install.bin

#------------------<<Installers added to the Docker container>>------------------

#------------------<<User-defined commands to go here>>------------------

ADD $IA_PROJECT_DIR$/dockerbuild_supporting_files/startupscript.sh /

RUN chmod ugo+x /startupscript.sh

CMD ./startupscript.sh

#------------------<<User-defined commands to go here>>------------------

------------------------------------------------------------------------------------------

9. Review the Run Command field to make sure it looks like the following:

docker run -d -p 8070:8080 iabookstore:1.0.0.0

After building the container and starting it, the IABookStore application should now be running at:

http://<IP_OF_DOCKERENGINE>:<PORT_ON_DOCKER_ENGINE_MAPPED_TO_PORT_ON_CONTAINER>/IABookStore

where:

<IP_OF_DOCKERENGINE>—The IP of the Docker engine provided in the Docker engine credential details.
<PORT_ON_DOCKER_ENGINE_MAPPED_TO_PORT_ON_CONTAINER>—Port number on the Docker engine host which is mapped to the port inside the IABookStore container. This information is available from the -p argument in the Run command.