docker/ by Nima Shokouhfar

This mind map serves as a comprehensive guide to Docker usage and commands, focusing on Docker Compose, volumes, and container management. It covers how to handle .env files, recreate specific containers, and manage data persistence with host volumes, anonymous volumes, and named volumes (recommended for production). The map also provides examples of Docker Compose configurations and details on running Nx with Docker. Key Docker commands are included for starting, stopping, building, and mon...

Get Started. It's Free
or sign up with your email address
docker/ by Nima Shokouhfar by Mind Map: docker/ by Nima Shokouhfar

1. Styles

1.1. bad

1.2. good

1.3. not as good

1.4. not as bad

1.5. important

1.6. warning

2. main

2.1. docker compose

2.1.1. command

2.1.2. seperate .env file

2.1.2.1. env_file: - ./api.env

2.1.3. recreate only one

2.1.3.1. docker-compose -f /opt/docker_app/docker-compose.base.yml -f /opt/docker_app/docker-compose.override.yml up -d --no-deps --force-recreate keycloak

2.2. volumes

2.2.1. for data presistence

2.2.1.1. connectiong the host file system to a virtual directory of container file system

2.2.2. types

2.2.2.1. Host volume

2.2.2.1.1. we define the absolute path of host directory to the virtual path inside the container

2.2.2.2. Anonymous volume

2.2.2.2.1. docker create a volume for us and mount it the virtual path inside the container

2.2.2.3. named volumes

2.2.2.3.1. docker create a volume with a name which is given by us. Then it mounts this volume to the virtual path inside the container

2.2.2.3.2. This is the type that we should use the most in production

2.2.3. Docker compose example for named volumes

2.2.4. relative paths

2.2.4.1. the path that docker compose exist

2.3. Nx

2.3.1. package.json

2.3.1.1. How I set up docker

2.4. commands

2.4.1. C:\Users\Nima\.docker

2.4.2. start

2.4.2.1. docker start

2.4.2.1.1. to start existing container

2.4.2.2. docker stop

2.4.2.3. docker restart

2.4.2.4. docker-compose down

2.4.2.5. docker-compose up -d

2.4.2.5.1. This command reads the docker-compose.yml file and starts the services defined within it. If the services are not already built, it builds them according to the configuration specified.

2.4.3. container

2.4.3.1. gcr

2.4.3.1.1. docker push gcr.io/education-367706/edu.server:v1

2.4.3.1.2. ***docker tag edu.server gcr.io/education-367706/edu.server:v1* **

2.4.4. monitor

2.4.4.1. docker ps

2.4.4.1.1. docker ps -a

2.4.5. docker logs -f d9165eedbdbb

2.4.6. ssh

2.4.6.1. ssh -p 22 [email protected]

2.4.6.2. exit

2.4.7. ***powershell start-process powershell -verb runas* **

2.4.8. #note: call from A:/hope

2.4.9. ***docker build -t edu.server -f apps/edu.server/Dockerfile . * **

2.4.10. shell/ ssh / troubelshoot container

2.4.10.1. docker exec -it <id/tag> /bin/bash

2.4.10.1.1. ***docker exec -it 6f31760c0358 /bin/bash * **

2.4.10.1.2. see it live

2.4.10.1.3. If it didn't work try this

2.4.11. #get docker status

2.4.12. ***docker tag 78cc5a404e0a gcr.io/education-367706/edu.server:v1* **

2.4.13. ***docker build -t edu.server -f apps/edu.server/Dockerfile . * **

2.4.14. name a container

2.4.14.1. docker run --name foo foo:latest

2.4.14.1.1. example

2.4.15. *** docker build -t edu.server -f apps/edu.server/Dockerfile . * **

2.4.15.1. ***docker build -t hope.api -f apps/hope.api/Dockerfile . * **

2.4.16. clean up

2.4.16.1. clean up

2.4.16.1.1. docker system prune -a --volumes

2.4.16.1.2. sudo du -sh /var/log/*

2.5. docker image

2.5.1. arm based

2.5.1.1. FROM --platform=linux/arm64 node:22-alpine