Day - 1: Docker - https://youtu.be/3c-iBn73dDE
-
What is docker? What is a Container?
-
Docker vs. Virtual Machine
-
Docker installation
-
Main commands
-
Debugging a Container
-
Developing with Containers
-
Docker Compose - Running multiple services
-
Dockerfile - Building own Docker image
-
Private Docker Repository (AWS)
-
Deploying the containerized App
-
Volumes - Persiting Data
-
Volumes demo
-
package, necessary dependencies and configuration
-
portable artifact, shared and moved
-
develop and deploy, more efficient
-
Container is made of images (linux image layer, ..., application image layer)
- Container repository (https://hub.docker.com/)
-
Before containers: New projects -> install serivices (PostgresSQL, Redis, Node, ...) -> Many steps, version, OS
-
After containers: New projects -> install isolated environment, packaged with all needed configuration -> one command for one service
- Different between container and image
- CONTAINER Port vs HOST port
docker pull
(version tag)docker run
(-d, :version, -p)docker start
docker stop
docker ps
(-a)docker exec -it
(/bin/bash) (ls, cd, pwd, env, exit)docker logs
Note:
-
Docker network connect two containers (if their in the same network)
-
Restart container -> data is gone (using volumes for data persistence)
-
Using docker-compose file to structure command when using docker to run container (also it auto did the network stuff for you)
-
Adjust dockerfile -> rebuild the image
Command:
docker-compose up -d
docker rm
docker rmi
docker build
(-t)
-
Docker private repository (on AWS ECR, AWS CLI, Credential configure)
-
Registry options
-
Image naming in docker registries (registryDomain/imageName:tag)
Command:
docker images
docker login
docker push
/
-
Add my-app image (project image) on the docker-compose file
-
change the MongoCLient.connect url to mongodb
-
should use Named Volume volumes when working with product
-
change from container affect host and vice versa (speicific file is configured in docker-compose
volumes
or-v
if using CLI)