How to run a locally-built Streaming Docker image on an AWS EC2 instance

How to run a locally-built Streaming Docker image on an AWS EC2 instance

book

Article ID: KB0073342

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10.6 and later

Description

I have built and run a local docker image for my Streaming application. How can I transfer and run this image on an AWS EC2 instance?
 

Resolution

First, stop the local container (named docker_1st for this example):
$ docker stop docker_1st
Commit the container's settings, and create a new image (named docker_1st_image):
$ docker commit docker_1st docker_1st_image
Save the image to a zip archive:
$ docker save docker_1st_image | bzip2 > docker_1st_image.bz2
Copy the zipped image to your AWS EC2 instance:
$ scp -i YourAwsKeys.pem docker_1st_image.bz2 ec2-user@awshost:/tmp/
Connect to the AWS EC2 instance, and install docker (if not already installed):
$ ssh -i YourAwsKeys.pem ec2-user@awshost
$ sudo yum install -y docker
Next, verify the copied image archive:
$  md5sum /tmp/docker_1st_image.bz2
ea5eb9d7047d8c4978603d80f30ebf41 
The returned md5 value should match the value of your local copy of the image.

Next, load the image (run with sudo):
$ sudo cat /tmp/docker_1st_image.bz2 | sudo docker load
...
Loaded image(s): localhost/docker_1st_image:latest
Finally, run the image (again, with sudo):
$ sudo docker run -d -p 11000:11000 --name docker_1st localhost/docker_1st_image:latest

Issue/Introduction

Outlines the steps needed to transfer a locally-built Docker image to an Amazon Web Services (AWS) EC2 instance, and run it in the AWS environment.