Last active
          November 17, 2021 23:52 
        
      - 
      
- 
        Save Dizolivemint/7c5e29ab6e338c55ddb75db19934d6a1 to your computer and use it in GitHub Desktop. 
Revisions
- 
        Dizolivemint revised this gist Nov 17, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Docker ```docker build .``` will run the Dockerfile to create an image ```docker build . -t [Dockerhub-username]/[image-name]:[v1]``` build an image with a specific version ```docker push [Dockerhub-username]/[image-name][v1]``` push to dockerhub ```docker images``` will print all the available images ```docker run {IMAGE_ID}``` will run a container with the image ```docker run -d {IMAGE_ID}``` will run a container with the image in the background 
- 
        Dizolivemint revised this gist Nov 17, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # Docker ```docker build .``` will run the Dockerfile to create an image ```docker build . -t [Dockerhub-username]/[image-name]:[v1]``` build an image with a specific version ```docker push [Dockerhub-username]/[image-name][v1]``` push to dockerhub ```docker images``` will print all the available images ```docker run {IMAGE_ID}``` will run a container with the image ```docker run -d {IMAGE_ID}``` will run a container with the image in the background 
- 
        Dizolivemint revised this gist Nov 17, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,11 +57,15 @@ Delete any services that have an associated EXTERNAL-IP value. These services ar ```kubectl delete svc <service-name>``` Delete the cluster and its associated nodes with the following command, replacing <prod> with your cluster name. ```eksctl delete cluster --name <prod>``` Inspect a pod ```kubectl logs <podname>``` Apply env variables and secrets ```kubectl apply -f aws-secret.yaml``` ```kubectl apply -f env-secret.yaml``` ```kubectl apply -f env-configmap.yaml``` Remove env variables and secrets ```kubectl delete -f <config.yaml>``` Deployments - Double check the Dockerhub image name and version in the deployment files ```kubectl apply -f deployment.yaml``` Service 
- 
        Dizolivemint revised this gist Nov 15, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ Run the docker image Check env variables ```docker-compose config``` Stop docker compose ```docker-compose down --remove-orphans``` To delete all dangling images ```docker image prune --all``` 
- 
        Dizolivemint revised this gist Nov 15, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ # Docker ```docker build .``` will run the Dockerfile to create an image ```docker images``` will print all the available images ```docker run {IMAGE_ID}``` will run a container with the image 
- 
        Dizolivemint revised this gist Nov 15, 2021 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -64,4 +64,15 @@ Apply env variables and secrets Deployments - Double check the Dockerhub image name and version in the deployment files ```kubectl apply -f deployment.yaml``` Service ```kubectl apply -f service.yaml``` # Expose IP Check the deployment names and their pod status ```kubectl get deployments``` Create a Service object that exposes the frontend deployment The command below will ceates an external load balancer and assigns a fixed, external IP to the Service. ```kubectl expose deployment frontend --type=LoadBalancer --name=publicfrontend``` Check name, ClusterIP, and External IP of all deployments ```kubectl get services``` ```kubectl get pods``` It should show the STATUS as Running For more info, refer to [this tutorial](https://kubernetes.io/docs/tutorials/stateless-application/expose-external-ip-address/) 
- 
        Dizolivemint revised this gist Nov 15, 2021 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,4 +55,13 @@ List all services running in your cluster. Delete any services that have an associated EXTERNAL-IP value. These services are fronted by an Elastic Load Balancing load balancer, and you must delete them in Kubernetes to allow the load balancer and associated resources to be properly released. ```kubectl delete svc <service-name>``` Delete the cluster and its associated nodes with the following command, replacing <prod> with your cluster name. ```eksctl delete cluster --name <prod>``` Apply env variables and secrets ```kubectl apply -f aws-secret.yaml``` ```kubectl apply -f env-secret.yaml``` ```kubectl apply -f env-configmap.yaml``` Deployments - Double check the Dockerhub image name and version in the deployment files ```kubectl apply -f deployment.yaml``` Service ```kubectl apply -f service.yaml``` 
- 
        Dizolivemint revised this gist Nov 15, 2021 . 1 changed file with 38 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,11 @@ ```docker ps``` will print all the running containers ```docker kill {CONTAINER_ID}``` will terminate the container Open bash into a particular container ```docker exec -it <container-id> bash``` Navigate to the specific file to ensure that your edits are there. ```cat <qualified-filename>``` Viewing Logs ```docker logs``` @@ -18,4 +23,36 @@ Include dead containers ```docker ps -a``` View Details of Docker Objects ```docker inspect``` # Docker Compose Make sure the Docker services are running in your local machine Remove unused and dangling images ```docker image prune --all``` Run this command from the directory where you have the "docker-compose-build.yaml" file present ```docker-compose -f docker-compose-build.yaml build --parallel``` Run the docker image ```docker-compose up``` Check env variables ```docker-compose config``` Stop docker compose ```docker-compose down``` To delete all dangling images ```docker image prune --all``` EKSCTL to auto provision a cluster ```eksctl create cluster --name myCluster --region=us-west-1 --nodes-min=2 --nodes-max=3``` Once you get the success confirmation, run ```kubectl get nodes``` Describe stacks ```eksctl utils describe-stacks --region=us-west-1 --cluster=myCluster``` List all services running in your cluster. ```kubectl get svc --all-namespaces``` Delete any services that have an associated EXTERNAL-IP value. These services are fronted by an Elastic Load Balancing load balancer, and you must delete them in Kubernetes to allow the load balancer and associated resources to be properly released. ```kubectl delete svc <service-name>``` Delete the cluster and its associated nodes with the following command, replacing <prod> with your cluster name. ```eksctl delete cluster --name <prod>``` 
- 
        Dizolivemint revised this gist Oct 8, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ ```docker build .``` will run the Dockerfile to create an image ```docker images``` will print all the available images ```docker run {IMAGE_ID}``` will run a container with the image ```docker run -d {IMAGE_ID}``` will run a container with the image in the background ```docker ps``` will print all the running containers ```docker kill {CONTAINER_ID}``` will terminate the container 
- 
        Dizolivemint revised this gist Oct 8, 2021 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,20 @@ ```docker build .``` will run the Dockerfile to create an image ```docker images``` will print all the available images ```docker run {IMAGE_ID}``` will run a container with the image ```docker ps``` will print all the running containers ```docker kill {CONTAINER_ID}``` will terminate the container Viewing Logs ```docker logs``` Attaching to a Container ```docker exec -it sh``` View Docker Processes ```docker ps``` Include dead containers ```docker ps -a``` View Details of Docker Objects ```docker inspect``` 
- 
        Dizolivemint revised this gist Oct 8, 2021 . 1 changed file with 11 additions and 6 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,19 @@ docker build . will run the Dockerfile to create an image docker images will print all the available images docker run {IMAGE_ID} will run a container with the image docker ps will print all the running containers docker kill {CONTAINER_ID} will terminate the container Viewing Logs docker logs Attaching to a Container docker exec -it sh View Docker Processes docker ps Include dead containers docker ps -a View Details of Docker Objects docker inspect 
- 
        Dizolivemint revised this gist Oct 8, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,6 @@ docker exec -it sh View Docker Processes docker ps Include dead containers docker ps -a View Details of Docker Objects docker inspect 
- 
        Dizolivemint revised this gist Oct 8, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,5 +9,7 @@ Attaching to a Container docker exec -it sh View Docker Processes docker ps Include dead containers docker ps -a View Details of Docker Objects docker inspect 
- 
        Dizolivemint revised this gist Oct 8, 2021 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,12 @@ docker build . will run the Dockerfile to create an image docker images will print all the available images docker run {IMAGE_ID} will run a container with the image docker ps will print all the running containers docker kill {CONTAINER_ID} will terminate the container Viewing Logs docker logs Attaching to a Container docker exec -it sh View Docker Processes docker ps View Details of Docker Objects docker inspect 
- 
        Dizolivemint created this gist Oct 8, 2021 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ docker build . will run the Dockerfile to create an image docker images will print all the available images docker run {IMAGE_ID} will run a container with the image docker ps will print all the running containers docker kill {CONTAINER_ID} will terminate the container