Install Docker on AWS


First thing first. Launch an instance with the Amazon Linux AMI and Connect to your instance.

Install Docker

Update the installed packages and package cache on your instance.

sudo yum update -y

Install Docker and Start the service.

sudo yum install -y docker
sudo service docker start

Add the ec2-user to the docker group so you can execute Docker commands without using sudo.

sudo usermod -a -G docker ec2-user

Install Docker Compose

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Apply executable permissions to the binary

sudo chmod +x /usr/local/bin/docker-compose

Log out and log back in again to pick up the new docker group permissions.

docker-compose --version
docker --version


Getting Started with OpenShift Origin on Windows

First thing first. Install Docker.

Once Docker is running, add an insecure registry of

  • 1) Right click on the Docker icon in the notification area and select Settings…
  • 2) Click on Docker Daemon in the settings dialog
  • 3) Edit the Docker daemon configuration by adding “” to the “insecure-registries”: setting { “registry-mirrors”: [], “insecure-registries”: [ “” ] }
  • 4) Click on Apply and Docker will restart.


Once you have successfully done that it is time install the OpenShift client.

  • Download OpenShift client.
  • Extract the content to a folder and place it in your path.
  • That’s it. You are all set.

Now let’s get started hacking your first OpenShift project.

Open a Command window as Administrator and run:
oc cluster up

You will see the following if all went ok.

Here are some handy OpenShift CLI commands.

This in no way a complete list of all the OC command. For complete list and OpenShift reference, please click here and here.

Cluster Up
oc cluster up

Cluster Down
oc cluster down

Return information about the current session
oc whoami

Display client and server versions
oc version

End the current server session
oc logout

Start a new session
oc login -u system:admin

Create new Project
oc new-project sample-demo \
--description="This is an example sample project" \
--display-name="Sample OpenShift Demo"

Delete a Project
oc delete project sample-demo

Switch to a project
oc project

Show an overview of the current project
oc status

Display existing projects
oc projects

View all projects you have access to
oc get projects

See a list of all services in the current project
oc get svc

Describe a deployment configuration in detail
oc describe dc nodeapp-1-aqtx7

Create an application using a remote Git repository
Before proceeding, make sure have Git installed on your workstation.
oc new-app

Specify a Git branch to use by appending #dev to the end of the URL
oc new-app

Add labels to the created objects.
oc new-app -l name=hello-world

Create an application from the DockerHub MySQL image
oc new-app mysql

Create multiple applications from a source repository and DockerHub image
oc new-app mysql

Deploying multiple images together in a single pod
oc new-app nginx+mysql

And finally, help about any command
oc help

Docker Cheat Sheet

Here is a list of some basic Docker Commands to help you get started with Docker. This helped me a lot and still does from time to time. Note, this not meant to be a complete Docker reference. For complete list, please visit


Pull a base image.
docker pull ubuntu

Start a container
docker run --name docker-nginx -p 80:80 -d nginx
docker run --name docker-nginx -p 80:80 -d -v /app/html:/usr/share/nginx/html nginx

For list of running containers
docker ps

For list of all containers
docker ps - a

Restart a Container.
docker restart container_id

Show all running process in a Container.
docker top container_id

Stop container
docker stop container_id

Remove container
docker rm container_id>

Kill containers and remove them
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rm $(docker kill $(docker ps -aq))

Clean up old containers that are weeks old (via Stackoverflow)
docker ps --filter "status=exited" | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm

Print the last 100 lines of a container’s logs
docker logs --tail 100 container_id

Create a new bash process inside the container and connect it to the terminal
docker exec -it container_id bash

Docker Container link
Docker run -d -p 5000:5000 --link redis dockerapp:v0.3

Docker Images

Remove all images
docker rmi $(docker images -q) -f
docker rmi $(docker images -qf "dangling=true")

Remove all images except “my-image”
You could use grep to remove all except my-image and ubuntu
docker rmi $(docker images | grep -v ‘ubuntu\|my-image’ | awk {‘print $3’})

Save a running container as an image
docker commit -m "commit message" -a "author" container_id username/image_name:tag

Other Docker Commands

Run commands inside an existing container
docker exec -it [containerID] bash

Push to Images to Docker
docker tag 2f98ca2e63ab docker-nginx:1.01
docker login --username muralibala
docker push docker-nginx:1.01

To find Ip address
docker machine ls

List the networks
docker network ls

List the volumes
docker volume ls