I used to think is a hard process, but when I actually tried it out I realized it’s not hard at all. Well, dockerizing isn’t an actual name, but it’s an easy way of saying containerizing a setup using docker. I didn’t come up with that name but my colleagues did, I’m merely using it since it’s actually easier to call it that :). dockerizing Anyhow, as I mentioned earlier once you actually start doing it, it doesn’t look hard at all. Let me guide you through it step by step using docker and WSO2 products. First of all, install and in your computer. I will not go through this procedure in detail since you can find dozens of articles online explaining how to do it. Once you are done with this step, create a folder (I will call it ) and copy the zip file of the WSO2 product into it. Create a file by the name inside and just leave it empty. I will explain what to put in this file, later in the article. Then create another directory inside the and copy all the changed configuration files into that (I will call this directory “resources” from this point on-wards). Go into the resources directory and create a file in this directory named product-setup.sh (You can name this whatever you want :) ) docker docker-compose service_root Dockerfile service_root, service_root Once you are done with the initial skeleton, open the product-setup.sh file in a text editor, use command to install all the required packages inside the container. For example, in this case you need the unzip program to extract the product zip file inside the container. It’s also important to run command before running the installation commands to ensure the package manager cache is updated. A very minimal example product-setup.sh file will look as follows. apt-get install apt-get update apt-get updateapt-get install -y unzip unzip /tmp/wso2ei-6.1.1.zip -d /wso2 mv -f /tmp/resources/changed_config_files /wso2/wso2ei-6.1.1/path_to_the_relevant_config Don’t worry about how the product zip file got into /tmp , I will explain it later in the article. From this, the main idea you have to get into your head is, first you need to install relevant applications, then unzip the product zip to a desired folder and overwrite the relevant config files in the product distribution, with the updated config files you put to the resources directory. Rename “changed_config_files” to the file names and “path_to_the_relevant_config” to the path of the files in the distribution. After completing the product-setup.sh file, lets look at the . This is the file docker calls when it’s building the docker image. And in this file, we can also, specify the start up scripts for the docker image. I will first give an example that suits the current context and explain it line by line. Dockerfile FROM airdock/oracle-jdk:1.8 COPY wso2ei-6.1.1.zip /tmpADD resources /tmp/resources RUN chmod +x /tmp/resources/product-setup.sh && /tmp/resources/product-setup.shRUN chmod +x /tmp/resources/wait.sh CMD ["sh", "/wso2/wso2ei-6.1.1/bin/integrator.sh"] The first ‘ command specifies the base docker images to be used for the current docker image. This can change based on the requirement. Since I’m trying to run a product that needs java on the docker container, I picked an image with java. If you you need some other service, then you can use a different pre-built image. Please visit to explore the available pre-built images. You just have to select an image from here, then find the import address then use “ ” command to use that pre-built image. FROM’ docker-hub FROM The command is used to copy the product distribution into the docker image. In here, I’m copying it into the folder inside the container. Then add the resources directory to the container. These paths are used in the product-setup.sh file to perform various tasks. Then give execution access to the product-setup.sh and run it. The “ command specifies that the has to run upon start of the container. ‘COPY’ /tmp CMD” integrator.sh Now that we are done with the and the we can move on to define any other services that we need to run. Go out of the directory that contains the , create folders for the rest of the services and in the same way we did earlier, you can define the rest of the services as well. After defining the setup for all the services we can use docker-compose to build and run those services. First we need to define the file outside the directories. You can refer to documentation to get a better idea about the In this article I will briefly explain how you can use docker-compose to build and run these containers defined. Please see the example file below. product-setup.sh Dockerfile, Dockerfile docker-compose.yml service_root this docker-compose.yml. docker-compose.yml version: '2' services:integrator-service:image: integrator-imgcontainer_name: integrator-svcbuild: ./ei-setupdepends_on:- analytics-service- mb-serviceports:- 9443:9443- 8243:8243- 8280:8280 First line specifies which version of the docker-compose definitions we are using. Then under services you can define details about the services which you would like to build and start using docker-compose. In this file, under we give a name to our service (in this case “ ”). “Image” specifies the name of the build image, “container_name” specifies the name of the container, “build” specifies the name of the folder for a particular service, “depends_on” specifies which services needs to start before the current service starts. This is a bit tricky though, because when you list down a set of services that needs to start first, docker-compose makes sure to start them before the current service, but it doesn’t make sure those services are up and running before it starts the current service. Therefore, you might run into issues if you are using dependent services, but in that case all you have to do is add a line in the start script of your service to wait till these dependent services are up and running. Then in the “ports” section, you can specify which ports needs to be exposed to the outside ( is the syntax to expose ports. services integrator-service product_port:container_port Another important thing is, if you want to communicate between these services, you can refer to them as . Protocol can be http, tcp, etc. and the service name and the ports has to be as defined in the . protocol://service_name:port docker-compose.yml Now, you are all set, you can run the command to build and run the docker containers. docker-compose build && docker-compose up, I hope this article was helpful in understanding how to containerize WSO2 products using docker. If there are any questions or any problems you run into while trying this out, please put them in the comments section. I will try and answer all the questions as soon as possible.