The following section is relevant to building WSO2 product Docker images
Step 1 - Obtain WSO2 Dockerfiles
Use one of the following options to obtain the WSO2 Dockerfiles.
Option 1 - Clone the WSO2 Dockerfiles repository
Clone the WSO2 Dockerfiles repository and checkout the latest release tag. You can find the latest release tag in the releases page of WSO2 Dockerfiles repository.
isuru@isuru-ThinkPad:/tmp$ git clone https://github.com/wso2/dockerfiles.git Cloning into 'dockerfiles'... remote: Counting objects: 2396, done. remote: Compressing objects: 100% (114/114), done. remote: Total 2396 (delta 60), reused 0 (delta 0), pack-reused 2282 Receiving objects: 100% (2396/2396), 293.95 KiB | 54.00 KiB/s, done. Resolving deltas: 100% (1674/1674), done. Checking connectivity... done. isuru@isuru-ThinkPad:/tmp$ cd dockerfiles/ isuru@isuru-ThinkPad:/tmp/dockerfiles$ git checkout tags/v1.1.0 -b v1.1.0 Switched to a new branch 'v1.1.0'
Option 2 - Download the release artifacts
Download the archive that is relevant to the latest release from the releases page of the WSO2 Dockerfiles repository, and extract it.
isuru@isuru-ThinkPad:/tmp$ wget https://github.com/wso2/dockerfiles/releases/download/v1.1.0/wso2-dockerfiles-1.1.0.zip isuru@isuru-ThinkPad:/tmp$ unzip wso2-dockerfiles-1.1.0.zip isuru@isuru-ThinkPad:/tmp$ cd wso2-dockerfiles-1.1.0
In the context of this page, the clone location of the repository or the extracted location of the Dockerfiles release archive will be referred to as <DOCKERFILES_HOME>
.
Step 2 - Build the product Docker image
- Navigate to the relevant product's Docker image directory
<DOCKERFILES_HOME>/<PRODUCT_NAME>
. For example, for WSO2 API Manager:<DOCKERFILES_HOME>/<APIM_HOME>
- Add the product pack and JDK.
- Download and copy JDK 1.7 (jdk-7u80-linux-x64.tar.gz) pack to the
<DOCKERFILES_HOME>/common/provision/default/files
directory. - Download the relevant product pack and copy them to the
<DOCKERFILES_HOME>/common/provision/default/files
directory. For example, for WSO2 API Manager 1.9.1 download the product pack and copy the zip file to the<DOCKERFILES_HOME>/common/provision/default/files
directory.
- Download and copy JDK 1.7 (jdk-7u80-linux-x64.tar.gz) pack to the
Optionally, identify the build script options based on the selected build provisioning method.
Enterbuild.sh
in the terminal to view thebuild.sh
script usage for the respective product. For example, the following is thebuild.sh
script usage for WSO2 API Manager.
Options: -v [REQUIRED] Product version of WSO2AM -l [OPTIONAL] '|' separated WSO2AM profiles to build. "default" is selected if no value is specified. -i [OPTIONAL] Docker image version. -e [OPTIONAL] Product environment. If not specified this is defaulted to "dev". -o [OPTIONAL] Preferred organization name. If not specified, will be kept empty. -q [OPTIONAL] Quiet flag. If used, the docker build run output will be suppressed. -r [OPTIONAL] Provisioning method. If not specified this is defaulted to "default". Available provisioning methods are default, puppet, README.md. -t [OPTIONAL] Image name. If this is specified, it will be used as the image name instead of "wso2{product}" format. -y [OPTIONAL] Automatic yes to prompts; assume "y" (yes) as answer to all prompts and run non-interactively. -s [OPTIONAL] Platform to be used to run the Dockerfile (ex.: kubernetes). If not specified will assume the value as 'default'.
Build the Docker image by executing the
build.sh
script based on the selected build provisioning method.
The build script options vary based on the selected build provisioning method as follows:Format./build.sh -v <PRODUCT_VERSION>
Example./build.sh -v 1.10.0
The following format and example include some options that are used when building the Docker image using Puppet. For more options, see the build script usage, which was discussed above.
Format./build.sh -v <PRODUCT_VERSION> -r <PROVISIONING_METHOD> -s <PLATFORM_USED_TO_RUN_DOCKER> -l <PROFILES_TO_BUILD_FOR_CLUSTERING_PURPOSES>
Example./build.sh -v 1.10.0 -r puppet -s kubernetes -l worker
A detailed description of all functionalities supported by the build script is described in the helper scripts page.
Thereafter, view the Docker image that you created by executing the docker images
command. The Docker image will only be displayed if you have built it correctly.
root@isuru-ThinkPad:/tmp# docker images REPOSITORY TAG IMAGE ID CREATED SIZE wso2am 1.10.0 94afddfc1395 About a minute ago 1.027 GB ubuntu latest 97434d46f197 2 weeks ago 188 MB root@isuru-ThinkPad:/tmp#