This docker container runs a basic Express server at port 3000. The dependencies are installed using pnpm
package manager.
docker build -t <image_name> .
Notes:
--t
- Name and optionally a tag in the name:tag format
docker run --rm -d -p <desired_port>:<express_port> <image_name>
Notes:
--rm
- Automatically remove the container when it exits-d
- Make the container runs in the background and print the container ID-p
- Publish a container's port(s) to the host
docker ps
docker stop <container_id>
docker push <docker_hub_username>/<image_name>:<tag>
Note:
- Make sure you run
docker login
first before perform thedocker push
command - If no
:<tag>
defined, the tag defaults tolatest
- Minikube
- kubectl
Refer kube/deployment-service.yaml
minikube start
kubectl apply -f kube/deployment-service.yaml
kubectl get all
- Get the service name using the command below. In this repo case is
basic-express-k8s-service
kubectl get svc
- Then, run the minikube command as below:
minikube service <service_name>