-
Notifications
You must be signed in to change notification settings - Fork 0
Back‐end Develop Guide
TODO: put in general guidelines for back-end
- An image is a lightweight, standalone, and executable package that includes everything needed to run a piece of software, including the code, runtime, libraries, and system tools.
- It is a static snapshot of a file system, and it is built from a set of instructions called a Dockerfile.
- Images are used as a template to create containers.
- A container is a running instance of a Docker image.
- It encapsulates an application and its dependencies, isolating it from the host system and other containers.
- Containers are portable and can run consistently across different environments, thanks to the encapsulated nature of Docker images.
- Images are stateless and immutable. Once built, they don't change.
- Containers are a running, writable instance of an image. They are stateful, as they can have data and configurations that change during runtime.
- Images are built-time constructs. You create or update them by writing a Dockerfile and running the docker build command.
- Containers are runtime entities. They are created from images and run using the docker run command.
- Images are used for distribution and deployment. They serve as a blueprint for creating containers.
- Containers are the execution environment for a specific application and its dependencies.
Like Github repositories, Docker also has a repository but we do not upload images to the repository when we are developing.
There are four docker containers (glados-backend, glados-frontend, glados-mongodb, glados-DEVONLY-mongodb-express) and four docker images (glados-project-app-backend, glados-project-app-frontend, mongo, mongo-express).
Once you make changes to your DockerFile (which is backend.Dockerfile), you need to rebuild the docker image.
Locate MonoRepo/apps/backend
and execute this command:
docker build -t glados-project-app-backend:latest -f backend.Dockerfile .
Check if the images are up to date:
docker images
If you created a wrong image, if you want to remove an image:
docker image rm (id of the image)
There are three ways to access the running docker container:
Let's say if you want to access glados-backend container, then we can execute one of the three commands below:
docker exec -it glados-backend //bin/bash
docker exec -it glados-backend sh
docker exec -it glados-backend //bin/sh