Tutorial - Docker From Scratch [For Spring Developers] - from Vinoth Selvaraj (Udemy)
docker-compose build
- OR
docker-compose up --build -d
To start only certain service we have several opportunities
- Use command argument
docker-compose up mongo -d
- starts only mongo service
- Use profiles
docker-compose up -d
- only mongo_stack startsdocker-compose --profile=app up -d
- additionally starts services with profile app
-
Command line:
- art-vinsguru-spring-docker\job-service>
docker build -t artarkatesoft/art-vinsguru-job-service:multistage -f ./Dockerfile-multistage ./../
- art-vinsguru-spring-docker\job-service>
-
Docker-compose:
- art-vinsguru-spring-docker\docker-compose\art-vinsguru-docker>
docker-compose --profile=multistage-build build
- art-vinsguru-spring-docker\docker-compose\art-vinsguru-docker>
mvn spring-boot:build-image
Mockserver dashboard
- Start full stack with elastic cluster
docker-compose --profile=app --profile=logging-elk up
- In case of error in Windows
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
- use commands for Windows
wsl -d docker-desktop
sysctl -w vm.max_map_count=262144
- or permanently add
vm.max_map_count = 262144
to /etc/sysctl.conf
- Start full stack with elastic cluster
docker-compose --profile=app --profile=logging-elk up -d
- View
filebeat
logs
- Exiting: error loading config file: config file ("filebeat.yml") can only be writable by the owner but the permissions are "-rwxrwxrwx" (to fix the permissions use: 'chmod go-w /usr/share/filebeat/filebeat.yml')
- in Windows we can disable the permission checking by adding:
command: filebeat -e -strict.perms=false
- View logs
- localhost: 5601
- Kibana -> Discover ->
- Create index pattern
- Your index pattern matches 2 sources.
- Index pattern name:
filebeat*
- Next step
- Select a primary time field for use with the global time filter.
@timestamp
- Create index pattern
- Kibana -> Discover
- Find a trace
- View dependencies (other microservices)
- Find logs of a request by trace_id in Kibana
- Add index pattern into Kibana
- Menu → Management → Stack Management →
- Index Patterns → Create index pattern →
zipkin*
- Discover zipkin data
- Discover → Change index pattern →
zipkin*
- by
traceId
- i.e.
traceId : "13eb59a6cfc10547"
(choose one)
- i.e.
- Discover → Change index pattern →