This repo was made for teaching full stack developers tha Docker technology.
Clone the repository and install dependencies for the project.
App itself is made as a simple node.js script, which will be just used for learning purposes. Open terminal and in a project direstory, run:
node src/app.js
This documentation provides a quick reference to basic Docker commands used in our project. It's designed to help developers quickly spin up, manage, and interact with Docker containers.
- Docker installed on your machine.
- Basic understanding of Docker commands and concepts.
docker compose up
This command starts all the services defined in your docker-compose.yml file.
docker ps
Use this to see all currently running containers.
docker run -p 5001:8080 c9b19b0e6729
This command runs a container and maps port 8080 inside the container to port 5001 on the host machine.
docker build -t kacperher/Api-as-a-service-demo:1.1 .
This builds a Docker image from a Dockerfile in the current directory and tags it with a specific version.
docker run f6413f4104c8
This command creates and starts a container from the specified image.
docker rm d8f60915f384
Use this command to remove a stopped container.
docker ps -a
This shows all containers, including those that are not currently running.
docker run c9b19b0e6729
This starts a container based on the specified image ID.
Docker Desktop is an integrated development environment (IDE) for building, sharing, and running containerized applications and microservices. It's designed to streamline Docker workflows, offering a user-friendly interface and compatibility with multiple platforms.
Follow these steps to install Docker Desktop on your machine:
- Download: Go to the Docker Desktop for Windows page and download the installer.
- Install: Double-click the installer file and follow the on-screen instructions.
- Run: After installation, run Docker Desktop from the Start menu.
- Download: Visit the Docker Desktop for Mac page to download the installer.
- Install: Open the downloaded
.dmg
file and drag Docker to the Applications folder. - Run: Open Docker from the Applications folder.
Here’s how to get started with Docker Desktop:
- Open Docker Desktop: Ensure Docker is running on your system.
- Open Terminal (or Command Prompt on Windows): Run Docker commands here.
- Example Command: To run a simple Hello World container, type:
docker run hello-world
or use the dashboard:
In this project, we use Kubernetes (K8s) for orchestrating and managing our containerized Node.js application. The configurations for K8s are organized in a dedicated directory to maintain a clear structure and ease of navigation.
/k8s
Directory:- This directory contains all the necessary Kubernetes YAML files for deploying our application. It includes configurations for various K8s resources such as Deployments, Services, and Ingresses.
deployment.yaml
:- Defines how our Node.js application is deployed on the Kubernetes cluster. It specifies the Docker image to use, the number of replicas, and other deployment settings.
service.yaml
:- Contains the configuration for exposing our Node.js application to the outside world or within the Kubernetes cluster.
- Additional files, such as
ingress.yaml
,configmap.yaml
, orsecret.yaml
, may also be present depending on the specific needs of our deployment.
- To deploy the application to a Kubernetes cluster, navigate to the
k8s
directory and run the following command:
kubectl apply -f .
This command will apply all the Kubernetes configurations located in the k8s directory.
These files are meant to be used by developers who are familiar with Kubernetes operations. Please ensure you understand the configurations and modify them according to your deployment environment.
For more detailed information on each configuration file and its purpose, please refer to the individual file documentation inside the k8s directory.
TODO:
google cloud mongoDB