Installing‎ > ‎

Install as a Docker Container

You can run Live API Creator as a Docker container.

Verify Prerequisites

Ensure that you have completed the following prerequisites:

  • Docker is installed and running properly. For more information about installing and running Docker, see the Docker documentation.

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.

Important! If you get an error message, do not continue with installing and configuring Live API Creator to run as a Docker container.

  • You have decided which port you would like API Creator to run on. This installation assumes that that port is 8080, but you can change that to any port you want (as long as it is greater than 1024, less than 65535, and not already in use).

The One-minute Version

You can run Live API Creator in non-persistent mode using the one-minute version. This method starts a Docker container with Live API Creator running on top of Apache Tomcat, using Derby as its repository and for its sample databases.

The Docker container does not remember anything, so do not invest too much time into it. Non-persistent mode is the simplest, but least powerful, way to run Live API Creator as a Docker container.

  1. Execute the following command line:
    docker run -p 8080:8080 caliveapicreator/3.0
  2. Connect your web browser:
    On Mac/Windows, typically:
    On Linux:
  3. Log in with user name admin, password Password1.
You are logged in and up and running.

Decide How you Want to Run the Container

You can run Live API Creator as a Docker container using a number of methods. The following sections describe how to run the container using one of the following methods:
  • Non-persistent mode. The Docker container does not remember anything. If you restart the container, any changes you have made, any APIs you may have created, are forgotten. This is useful for quick demos, training, etc., or when you want a clean slate every time you start the image, and you don't plan to keep any changes.
  • Persistent mode. The Docker container stores its information on the host's file system. If you restart the container, your changes are remembered. This is useful when using Live API Creator for an extended period of time and you want to keep the changes you make.
  • MySQL mode. The Docker container stores 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.
Note: in all cases, if you want to avoid the End User License Agreement screen when you first connect, you can start the Docker container with a special parameter:

docker run -p 8080:8080 -e ca_accept_license=true caliveapicreator/3.0

Run the Container in Non-Persistent Mode

You can run Live API Creator as a Docker container in non-persistent mode using the following methods:

  • Start the Docker container. Issue the following command:
docker run \
        -p 8080:8080 \
        caliveapicreator/3.0

This command does not return and shows you the output of the container. This is usually helpful for diagnosing problems:

Note: This command is also used in the "The One-minute Version" section. 

  • Run the Docker container in the background. Issue the following command, adding the -d option:
docker run \
        -d \
        -p 8080:8080 \
        caliveapicreator/3.0

There are many other options when running a Docker container. For more information about the options, see the Docker documentation.

Run the Container in Persistent Mode

Decide where you want Docker container to store its information. On Windows and Mac, the storage is in the Docker Machine, but you can share a directory between the host machine and the Docker Machine.

For more information about the Docker Machine, see the Docker documentation.

This procedure assumes the directory you will use is /home/docker/LiveAPICreator.

Issue the following command:

docker run \
        -p 8080:8080 \
        --volume=/home/docker/LiveAPICreator:/usr/local/CALiveAPICreator \
        caliveapicreator/3.0

Note that the path /home/docker/LiveAPICreator is a default: you can change it, but this should work in most cases. You cannot change the second part (/usr/local/CALiveAPICreator) -- it must be exactly as specified here.

Also note that this directory will not be deleted from the Docker machine if you delete the Live API Creator Docker image -- you will have to remove it by hand.

The first time you run the container in this mode, the following message appears:

Databases not found -- initializing with default

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

Run the Container in MySQL Mode

When you run Live API Creator as a Docker container using this mode, Live API Creator uses a MySQL database as its repository. You can provide your own MySQL database or you can use a pre-configured Docker container.

This procedure assumes that the directory you will use to store the MySQL data is /home/docker/lacadmin (this directory must exist in your Docker machine). You can specify a different location as long as that directory exists, is writable, and the underlying disk has enough free space.

  1. Start the MySQL container by issuing the following command:
    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
    Any recent version of the MySQL Docker image should work, but 5.6.29 is known to work. The MySQL container is now up and running. This can take 10-20 seconds after the container is downloaded.
  2. Start the Live API Creator container by issuing the following command:
    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/3.0
    This can take a few seconds to start up. In this configuration, sample APIs are not created. You can change these options to use a pre-existing MySQL installation instead of a Docker container.

Connect to API Creator

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

On Mac/Windows, typically:

http://192.168.99.100:8080/APICreator

On Linux:

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

On initial login, you will be asked to accept the End User License Agreement, unless you specified -e ca_accept_license=ENU on the command line.

Examine the Container

You can examine and look into the Docker container (when it's running!).

  1. Issue the following command:
    docker ps
  2. Find the Docker container ID, for example:
    CONTAINER ID        IMAGE                          COMMAND                  CREATED      
    9376d7985de1        caliveapicreator/3.0           "catalina.sh run"        4 minutes ago
  3. Start a shell in the container by issuing the following command:
    docker exec -i -t 9376d7985de1 bash

A command prompt appears. Tomcat runs in the /usr/local/tomcat directory. If you are run Live API Creator as a Docker container in non-persistent mode or persistent mode, the various Derby databases are in the/usr/local/CALiveAPICreator/databases directory.

Stop and Reset your Container

If you want to stop your Docker container(s), complete the following:

Note: The commands are in blue.

  1. Find the Docker container ID by issuing the following command:
    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/3.0    "StartLiveAPICreator."     7 minutes ago      Up 7 minutes     0.0.0.0:8080->8080/tcp
  2. Stop the Docker container by issuing the following command:
    docker stop 547911c7c2cc

or to stop the Docker container permanently, issue the following command:

$ docker rm 547911c7c2cc

To wipe the Docker container out completely, complete the following:

  1. Find the Live API Creator's Docker image ID by issuing the following command:
    docker images
    REPOSITORY               TAG             IMAGE ID        CREATED        SIZE
    caliveapicreator/3.0     latest          96b2a3d11452    2 days ago     580.4 MB
    mysql                    5.6.29          cf859bd8ff7f    3 weeks ago    324.2 MB
  2. Remove the image by issuing the following command:
    docker rmi 96b2a3d11452

Databases

Databases can be difficult to install. Docker can make it easy. To get some informal information, check out the Tech Blog.