- Run the wordpres docker-compose.
- Run the docker-dojo app
- Comment the line number 10 of hello-world.rb and rebuild the docker.
- Run the rebuild Docker.
- Push the rebuilt Docker image to the tag
:no-redis
- Run the ruilt Docker Image Localy, now you can see the app hello world.
- Uncomment the line number 10, push the image to the tag
redis
. - Try to make yourself the docker-compose for the sinatra app with the redis image.
docker login -u username -p password
- Building the image
cd app
docker build -t maneta/sinatra .
- Run the Container Image
docker run --rm -t -p 4567:4567 maneta/sinatra
- Pushing the Docker image to Docker Hub
docker push maneta/sinatra
- Repository: https://hub.docker.com/r/maneta/sinatra/
Useful commands:
All running dockers:
docker ps
All running and stopped dockers:
docker ps -a
Kill a container:
docker kill containerID
Remove a container:
docker rm containerID
List Docker Images:
docker images
Remove Docker image:
docker rmi imageID
- Start the docker compose:
cd compose
docker-compose up
- Shut Down the Compose
cd compose
docker-compose down
- All the configurations files are located on the k8s-conf-files directory
gcloud compute disks create --size 200GB redis-disk
- Output:
Created [https://www.googleapis.com/compute/v1/projects/ruby-app-1470156911832/zones/europe-west1-b/disks/redis-disk].
NAME ZONE SIZE_GB TYPE STATUS
redis-disk europe-west1-b 200 pd-standard READY
kubectl create -f redis-controller.yml
- Verify that the Redis Controller is running:
kubectl get pods
- Output:
NAME READY STATUS RESTARTS AGE
redis-q0ifr 1/1 Running 0 1m
kubectl create -f redis-service.yml
- Verify that the Redis service is running:
kubectl get services
- Output:
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.59.240.1 <none> 443/TCP 2h
redis 10.59.255.11 <none> 6379/TCP 1m
kubectl create -f sinatra-controller.yml
- Verify that the Sinatra Controller is running:
kubectl get pods
- Output:
NAME READY STATUS RESTARTS AGE
redis-q0ifr 1/1 Running 0 7m
sinatra-e3n4t 1/1 Running 0 1m
sinatra-h59za 1/1 Running 0 1m
kubectl create -f sinatra-service.yml
- Verify that the Sinatra service is running:
kubectl get services
- Output:
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.59.240.1 <none> 443/TCP 2h
redis 10.59.255.11 <none> 6379/TCP 1m
- Get Load Balancer Public IP
kubectl describe services frontend | grep "LoadBalancer Ingress"
- Output:
LoadBalancer Ingress: 104.155.27.74
- All the configurations files are located on the k8s-conf-files directory
oc create -f pvc.yml
oc create -f redis-controller.yml
kubectl create -f redis-service.yml