How to Push Docker Image to Google Cloud Repository (GCR) (Easy steps!)

      Here’s how to push your local docker image to your GCR (Google Cloud Repository). You might want to use your own docker image later for your containerized app or kubernetes. For this research, I use Ubuntu 18.04.03 LTS Install gcloud, see the full instructions here : https://cloud.google.com/sdk/docs/quickstarts Once you’ve installed the gcloud, … Read more

Setup Kubernetes on Ubuntu 16.04

Summary This setup is supposedly to install the kubernetes on ubuntu machine with version 16.04 (64bit). I did this in the cloud and have worked perfectly. # whoami && pwd root /root # apt-get update # apt-get install -y apt-transport-https # curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add – # echo “deb http://apt.kubernetes.io/ kubernetes-xenial main” … Read more

Create docker image and push to AWS ECR

Image tag : test-image awsudo -u aws-profile aws ecr get-login –no-include-email –region ap-southeast-1 sudo docker build -t test-image . sudo docker tag codebuild:test-image 743977200366.dkr.ecr.ap-southeast-1.amazonaws.com/codebuild:test-image sudo docker push 743977200366.dkr.ecr.ap-southeast-1.amazonaws.com/codebuild:test-image  

Fix cannot access internet in your docker container

I use docker for testing environment. Somehow I found out that the docker container cannot access the internet and the solution is really simple: $ sudo ifconfig docker0 down $ sudo service docker restart $ sudo ifconfig docker0 up Or $ sudo vim /etc/default/docker DOCKER_OPTS=”–dns 10.10.4.14 –dns 8.8.8.8 –dns 8.8.4.4″ Which: 10.10.4.14 in my localhost/laptop

Kubernetes cheatsheet

To list all deployments: kubectl get deployments –all-namespaces To delete deployment: kubectl delete -n NAMESPACE deployment DEPLOYMENT To get admin user token dashboard kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk ‘{print $1}’) Allow master to run pod kubectl taint nodes –all node-role.kubernetes.io/master- To join master node kubeadm … Read more

Docker command cheatsheet

docker build image $ sudo docker build -t image-name . docker to start a container from image $ sudo docker run -itd –name jenkins –publish 8080:8080 –publish 50000:50000 jenkins docker to get inside the container $ sudo docker exec -it jenkins bash docker stop container $ sudo docker stop image-id/name docker remove container $ sudo … Read more