Docs‎ > ‎Install Live API Creator‎ > ‎

Install as a Docker Container


You can run Live API Creator as a Docker container. This is only for demonstration purposes and is not supported for production.

Verify Prerequisites

Ensure that you have completed the following prerequisites:
  • You have have Docker installed and running.
  • You have decided which port you would like Live API Creator to run on. This installation assumes that port is 8080, but you can change that to any port you want (as long as it is greater than 1024 and less than 65535, and not already in use).
To check whether Docker is running properly, run the following command from the command line:

docker info

The output should give you some information about your version of Docker. 
If you get an error message, stop: you need to get Docker running properly before proceeding.

The one-minute version

If you just want to run Live API Creator right now, execute the following command line:

docker run -p 8080:8080 caliveapicreator/release

and connect your web browser to:

Mac/Windows, typically:  http://192.168.99.100:8080/APICreator

Login with user name admin, password Password1

And by all means consult the documentation. This is a powerful product with a lot of features.

What just happened?

If you ran the one-minute version above, you started a Docker container with Live API Creator running on top of Apache Tomcat, using Derby as its repository, and also for its sample databases. The container will not remember anything you do, so don't invest too much time into it.

This is the simplest, but least powerful way to run Live API Creator container. Read on to understand your options.

Decide how to run the container

There are (at least) three ways to run this container:
  1. Non-persistent mode: the container will not remember anything. If you restart the container, any changes you have made, any APIs you may have created, will be completely forgotten This is useful for quick demos, training, etc... when you want a clean slate every time, and you don't plan to keep any changes.
  2. Persistent mode: the container will store its information on the host's file system. If you restart the container, your changes will be remembered. This is useful when using Live API Creator for an extended period of time, and you want to keep any changes you make.
  3. MySQL mode: the container will store its information in a MySQL database, without any samples pre-installed. This is normally the mode used for production. This deployment method can be used in a cluster.

Option 1: Run the Container in Non-Persistent Mode

You can run a copy of Live API Creator by executing the command below (this was the one-minute version above). This command will not return, and will show you the output of the container.  This is usually helpful for diagnosing problems:

docker run \
    -p 8080:8080 \
    caliveapicreator/release

If you want to run it in the background instead, you'll need to add a -d option:

docker run \
    -d \
    -p 8080:8080 \
    caliveapicreator/release

There are other options when running a Docker container. For details, see the Docker documentation.

Option 2: Running the Container in Persistent Mode

You will need to decide where the persistent storage should be. On Windows and Mac, the storage will be in the docker-machine, but you can share a directory between the host machine and the docker-machine. Here, we assume that you will use /Users/jdoe/LiveAPICreator : change that to a directory that actually exists.

docker run \
    -p 8080:8080 \
    --volume=/Users/jdoe/LiveAPICreator:/usr/local/CALiveAPICreator \
    caliveapicreator/release

The first time you run the container in this mode, you will see a message:

Databases not found -- initializing with default

This indicates that the repository was not found, and therefore a default repository was created, pre-loaded with two sample projects.

Option 3: Running the Container in MySQL Mode

In this mode, Live API Creator will use a MySQL database as its repository. You can either provide your own MySQL database (version 5.5 or higher), or you can use a pre-configured Docker container. If you used the latter, we assume that you store the MySQL data in /home/docker/lacadmin, but you'll have to figure out where the best place is for you.

If you use the MySQL container, start it up:

docker run \
        -e MYSQL_ROOT_PASSWORD=Password1 \
        -e MYSQL_DATABASE=lacadmindb \
        -e MYSQL_USER=lacadminuser \
        -e MYSQL_PASSWORD=Password2 \
        --volume=/home/docker/lacadmin:/var/lib/mysql \
        -p 3306:3306 \
        mysql:5.6.29
 
When this MySQL container is up and running (it should take 10-20 seconds once the container is downloaded), you can start the Live API Creator container:

docker run \
        -e RDS_HOSTNAME=192.168.99.100 \
        -e RDS_PORT=3306 \
        -e RDS_USERNAME=lacadminuser \
        -e RDS_PASSWORD=Password2 \
        -e RDS_DB_NAME=lacadmindb \
        -e LAC_ADMIN_MAX_CONN=100 \
        -p 8080:8080 \
        caliveapicreator/release

This should just take a few seconds to start up. Note that, in this configuration, no sample APIs will be created.
As you have no doubt figured out, you can change these options to use a pre-existing MySQL installation instead of a Docker container.

Connect to the API Creator

Once the Live API Creator container is up, connect to it from your web browser. The exact URL you use depends on where and how you run the container:

Mac/Windows, typically:  http://192.168.99.100:8080/APICreator

By default, the user name is admin and the password is Password1

If you are curious

You can look under the hood and poke around the Docker container (when it's running!) in three simple steps:

docker ps

Look for the container ID, e.g.:

CONTAINER ID        IMAGE                          COMMAND                  CREATED      
9376d7985de1        caliveapicreator/release       "catalina.sh run"        4 minutes ago

Then start a shell in the container with:

docker exec -i -t 9376d7985de1 bash

You should get a command prompt.
Tomcat is running in /usr/local/tomcat 
If you are using option 1 or 2, the various Derby databases are in /usr/local/CALiveAPICreator/databases

Stopping and resetting

If you want to stop your container(s), find out its ID (typed commands are in blue) :

$ docker ps
CONTAINER ID   IMAGE                     COMMAND                 CREATED          STATUS          PORTS
ac7660d368e5   mysql:5.6.29              "/entrypoint.sh mysql"  31 seconds ago   Up 30 seconds   3306/tcp
547911c7c2cc   caliveapicreator/release  "StartLiveAPICreator."  7 minutes ago    Up 7 minutes    0.0.0.0:8080->8080/tcp

Then stop it with:

$ docker stop 547911c7c2cc

If you want to stop it permanently, use:

$ docker rm 547911c7c2cc

If you want to wipe it out completely (you'll need to do that to upgrade to a new version), you can find its image ID with:

$ docker images
REPOSITORY                   TAG             IMAGE ID        CREATED        SIZE
caliveapicreator/release     latest          96b2a3d11452    2 days ago     580.4 MB
mysql                        5.6.29          cf859bd8ff7f    3 weeks ago    324.2 MB

and remove the image with:

$ docker rmi 96b2a3d11452


Databases

Databases can be difficult to install. Docker can make it easy. Check out our Tech Blog for some informal information we have gathered.