Go to content
large_h-trans

Using Ceetron Cloud Components (C3) with Docker

Docker is a fantastic platform to run micro-services. We have added C3 to Docker, and this page describes how to get started using C3 together with Docker.

Running C3 locally with Docker

Follow these steps to install the C3 server and the examples locally on your machine: 

1.  Install Docker (if not already installed).
Docker is now available for Windows, Mac and Linux. Go to https://www.docker.com/products/overview#/install_the_platform to install Docker for your machine

2.  Install the c3 server
Open a command window / terminal and write:

docker run -p 8998:8998 -d ceetron/c3-server

You can verify that the server is running by opening http://localhost:8998 in your browser. This should show the following information:

Ceetron Cloud Server is alive
 Server ver: 1.0.0-33660 (add-on: 1.0.0-33660)
 Node.js ver: v6.9.2 (linux|x64)

 

3.  Install the examples
Open a command window / terminal and write:

docker run -p 80:80 -d ceetron/c3-examples

 

4.  Run the examples
Open http://localhost in your browser. You should see a welcome page with links to all the examples.
 

Running C3 on AWS with Docker

In this section we will create a free (t2.micro) Amazon EC2 instance from scratch and run C3 on it.

1.  Create the EC2 Instance
Login to the AWS console and select “Launch a virtual machine”

Give it a name (e.g. DockerC3Test), select “Amazon Linux AMI” as OS, “t2.micro” as instance type and create a private key that you download and keep safe. You should then see a summary like this:



Press “Create this Instance” and the virtual machine will be setup in a minute and you will see this message:



Go to the EC2 instance list to get the IP address of the new virtual machine (referred as MY-EC2-IP below)

2.  Login via ssh to the EC2 instance and start Docker

ssh –i DockerC3Test.pem [email protected]

Note: On Linux/Mac, you have to do chmod 400 DockerC3Test.pem before running the ssh command.

Then, when logging into the system, do:

$ sudo yum update -y
$ sudo yum install -y docker
$ sudo service docker start

See http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html for more information.

If you are using other Linux distributions, please refer to https://docs.docker.com/engine/installation/linux/ for a description on how to install Docker on the Linux distro of your choice.

3.  Install the C3 server and the client examples

$ sudo docker run -p 8998:8998 -d ceetron/c3-server
$ sudo docker run -p 80:80 -d ceetron/c3-examples
Check that the two are running with:

$ sudo docker ps

You should see two containers running.

 

4.  Open port 80 and 8998 on the EC2 instance
Select the EC2 instance in the EC2 instance list and select the Security Group.
Add Inbound rules for TCP on port 80 and 8998:



5.  Run the examples in your browser

Open “http://MY-EC2-IP” in your browser and check out the examples.

Here is an example instance:
http://c3.ceetron.com

Updated