Run WSO2 Api Manager with Docker
Lets start with docker terms
Dockerfile : A Dockerfile is a text document that contains all the commands you would normally execute manually in order to build a Docker image. Read more …
Docker Image : Docker images are the basis of containers. An Image is an ordered collection of root filesystem changes and the corresponding execution parameters for use within a container runtime. An image typically contains a union of layered filesystems stacked on top of each other. An image does not have state and it never changes. Read more …
Docker Repository : A repository is a set of Docker images. A repository can be shared by pushing it to a registry server. The different images in the repository can be labeled using tags. Read more …
Docker Registry : A Registry is a hosted service containing repositories of images which responds to the Registry API. Read more …
Docker Container : A container is a runtime instance of a docker image. Read more …
See the following digram to get the idea of how the above terms link together.
Hope you have high level understanding of how the docker is working. Lets try the above scenario with wso2-api-manager.
STEP 1: Create Dockerfile for WSO2-API-Manager
We need following major components to run the WSO2 API Manager on any environment.
- Java 8
- API Manager Distribution
STEP 2: Build the Docker image from the docker file.
I assume that you have install the docker in your development environment. Read more
$> docker build .
I got following output since I have already build the image.
STEP 3: Tag the image to the repository
You have to register on the docker cloud to maintain the image repositories. I have created one for the WSO2-API-Manager.
https://cloud.docker.com/swarm/sysensor/repository/docker/sysensor/wso2-api-manager
Then tag your image with the repository that you have created.
$> docker tag 324ba320d9b6 sysensor/wso2-api-manager
STEP 4: Push the tagged repository
Before you push you may need to login to your docker registry from the command line. Read more …
$> docker push sysensor/wso2-api-manager
STEP 5: Run the docker image from the repository
You have to do the port mapping for the exposed ports from the WSO2-API-Manager to get access from your local computer.
$>docker run -p 9443:9443 -p 9763:9763 -p 8243:8243 -p 8280:8280 -p 10397:10397 -p 7711:7711 sysensor/wso2-api-manager