# Welcome to the Docker cult
---
## docker
- builds and manages images
- can create virtual networks
- done via command line
- `docker run --rm -ti busybox bash`
---
## docker-compose
- uses yml files for configuration
- you can use multiple yml files and stick them together via `docker-compose -f <file1> -f <file2>`
- configuration gets merged and stuff from later files overwrites previous values
- via ENV variable `COMPOSE_FILE` you can define which files to load automatically
- `docker-compose config` prints out the compiled config
---
## stage systems
- what is happening?
- uses https://git.netresearch.de/magento-ci/magento2-docker, so the same setup our CI uses (including all the magic)
- makes use of the same features
- meta packages with `build/composer.json`
- see https://git.netresearch.de/dhl/infrastructure/extension-config
- additionally a proxy is running that automatically draws certificates for the systems and acts similar to Apache virtual host config
---
## occuring problems
and how to approach them
---
### system not reachable
- check https://grafana.nr/d/y38QOzxiz/node-exporter-full?orgId=1
- try ssh
- if no data available/ssh is failing:
- log into https://admin.jiffybox.de/
- find the server (UAT for Magento 2.3.x MNT-170 (J329496))
- kill it (Stoppen -> Strom ausschalten)
- start it again
- if systems still not available
- ssh into server
- navigate to the system's directory
- `docker-compose ps` should show services with exit code in the hundreds
- `docker-compose down [-v] && docker-compose up -d` should fix the system
---
### redirect to random other system on the server
- reason jwilder/proxy has not properly picked up the system
- `sudo service docker restart` will definitely fix the issue
---
### how can I do/debug Magento stuff in the container?
- navigate to systems directory
- `docker-compose run --rm -u www-data setup bash` starts up the container that usually does the system setup and preparation
- everything should be available there (composer etc)
---
### how can I see error logs?
- navigate to systems directory
- under `mnt/data/var` the magento var directory is mounted to the host (so you don't need to log into the setup container)
- `docker-compose logs -f nginx` shows the nginx log (where php logs errors), its long though
---
## local reproduction of CI
- local setup required that mimics the gitlab runner environment that is used in the jobs
- see live
---
{"metaMigratedAt":"2023-06-15T03:28:46.445Z","metaMigratedFrom":"YAML","title":"Welcome to the Docker cult","breaks":true,"description":"How to tame the whale","contributors":"[{\"id\":\"f5d70b05-1e27-451e-bb02-8ca71b5d3ddb\",\"add\":4505,\"del\":1880}]"}