-
create this nodejs app
-
create a "dockerfile", insert contents.
-
put in a .dockerignore file, with: node_modules
-
build the image: sudo docker build . -t frankc60/hello-world
-
check image is created with: sudo docker images
-
run the image in background: sudo docker run -p 8080:3000 -d frankc60/hello-world
(-p : for example EXPOSE 3000 (from dockerfile), so would use: -p 8080:3000 - to open port 8080 to network, via http://localhost:8080)
-
check app is running in background: sudo docker ps (to get the containerID) sudo docker logs
-
if you need to go into container: sudo docker exec -it /bin/bash
-
access from cmdline: curl http://localhost:8080
--Put into Kubernetes-- 1.create a pod.yaml file
2.create a service.yaml file
kubectl create -f pod.yaml kubectl get pods kubectl create -f service.yaml kubectl get svc
3.Delete the POD:
kubectl delete pod hello-world
4.update deployment.yaml, and create that instead of the pod.yaml.
*To update the docker tag version. make change n the pod.yaml or deployment.yaml file.