5 min docker

Post on 14-Jun-2015

298 Views

Category:

Technology

9 Downloads

Preview:

Click to see full reader

DESCRIPTION

Short introduce of using docker and build kubernetes cluster in GCE

Transcript

5 min DockerSimon Su @ MiCloud

What is Docker?

Docker community - Docker Hub

https://hub.docker.com

Docker installation

● Mac Installhttp://docs.docker.com/installation/mac/

● Windows Installhttp://docs.docker.com/installation/windows/

● Linux (CentOS) Installhttp://docs.docker.com/installation/centos/

● Othershttp://docs.docker.com/installation/

Run your docker VM on GCE

Google optimized docker container

$ gcutil --project=google-containers listimages

$ gcloud compute instances create docker-playground \ --image container-vm-v20140826 \ --image-project google-containers \ --zone asia-east1-b \ --machine-type f1-micro

Reference: https://cloud.google.com/compute/docs/containers/container_vms

Search in docker image repository

Run a container you want

$ docker run -it [container] [command]

Quick container without interrupt

Ctrl + p + q

Attach a running container

$ sudo docker attach [container-id]

Restart a stopped container

$ sudo docker start [container-id]

Run a container with port mapping

$ sudo docker run -it -p 8080:80 \

peihsinsu/bdutil bash

Commit your container

$ sudo docker commit -m “message” \

-a “author” e94475002a35 peihsinsu/bdutil

Push your container to docker hub

$ sudo push peihsinsu/bdutil

Private your own docker hub

$ sudo docker run -d -e GCS_BUCKET=simon-docker \

-p 5000:5000 google/docker-registry

https://registry.hub.docker.com/u/google/docker-registry/

After docker registry start

docker tag ubuntu server-ip:port/image-name

docker push server-ip:port/image-name

ex:

$ docker tag ubuntu 123.123.123.123:5000/ubuntu14

$ docker push 123.123.123.123:5000/ubuntu14

Pull self-registry docker image

docker pull server-ip:port/image-name

ex:

$ docker pull 123.123.123.123:5000/ubuntu14

Build docker from manifest file

$ sudo docker build -t="peihsinsu/nodejs-express4" .

Cluster your docker runtime

./hack/dev-build-and-up.sh

./cluster/kubecfg.sh -p 8080:80 run dockerfile/nginx 2 myNginx

./cluster/kubecfg.sh list pods

./cluster/kube-down.sh

How google use docker?

top related