Creating Custom docker images

Creating Custom Docker images for Updated Products

The create-docker command builds a Docker image of an updated product pack using the Docker resources developed by WSO2. However, the following steps should be followed if any customizations are required.

In this example, we will assume that we are creating a custom Docker image for an updated product of WSO2 API Manager 3.0.0
1. Go to the product Docker resources repository on GitHub (e.g., docker-apim).
2. Find the latest tag corresponding to the product version (e.g., v3.0.0.x)

3. Create a Docker project directory and navigate into it.

mkdir -p <PROJECT>/docker 
cd <PROJECT>/docker

4. Navigate to the Docker resources of the required Operating System, and download the Dockerfile, and> files into the project directory.


5. Create a zip file of the updated product pack and copy it into the Docker project directory.

zip -qr <path/to/product/wso2am-3.0.0>
cp <PROJECT>/docker

6. At this point, you should have the following files in your Docker project directory

cd <PROJECT>/docker

7. Open the Dockerfile in a text editor.
  a. Remove the wget command downloading the product pack over the internet.
  b. Add a COPY command before RUN to copy the created zip file into the image.


8. Make the necessary additional custom changes to the Dockerfile. For example, if we need to change the JDK version from the current version of 8 to 11, we must make the following changes.
  a. Identify the location where the JDK version is set.

  b. Change the line from FROM adoptopenjdk/openjdk8:jdk8u222-b10-alpine to FROM adoptopenjdk/openjdk11:jdk-11.0.10_9-alpine.
9. Build the Docker image with the tag in the PRODUCT_NAME:PRODUCT_VERSION.UPDATE_LEVEL format.

docker build . -t wso2am: