1. Run a pre-build docker image.
2. Build your own docker image and use it.
In the first option you can use a base image like Ubuntu, CentOS or an image built by someone else like thilina/ubuntu_puppetmaster. You can find these images index.docker.io
In the second option you can build the image using a "Dockerfile". In this approach we can do customizations to the container by editing this file.
When creating a docker container for WSO2 products option 2 is the best. I have wrote a sample Dockerfile on github. It describes how to build a Docker container for WSO2 API manager single node implementation. For the moment docker have some limitations like unable to edit the '/etc/hosts' file, etc. If you need to create a clusters of WSO2 products (an API manager cluster in this case) you need to do some additional things like setting up a DNS server, etc.
How to build an API manager docker container?
Get a git clone of the build repository.
Oracle JDK 7 tar.gz (not JDK 8) and place it in '/dockerfiles/base/dist/'
mvDownload WSO2 API manager and place that in '/dockerfiles/base/dist/'
mvChange directory to '/dockerfiles/base/'.
cd dockerfiles/base/Run docker command to build image.
docker build -t apim_image .
How to start API manager from the build image?
Start in interactive mode
docker run -i -t --name apim_test apim_imageStart in daemon mode
docker run -d --name apim_test apim_imageOther options that can use when starting a docker image
--dns < dns server address >
--host < hostname of the container >
Major disadvantages in docker (for the moment)
- Can't edit the '/etc/hosts' file in the container.
- Can't edit the '/etc/hostname' file. --host option can use to set a hostname when starting.
- Can't change DNS server settings in '/etc/resolve.conf'. --dns option can use to set DNS servers. Therefore, if you need to create a WSO2 product cluster you need to setup a DNS server too.