Saturday, November 7, 2020

Ch 11 Building and testing applications with Docker and Docker Compose - Learn Docker in a Month

Source:
https://livebook.manning.com/book/learn-docker-in-a-month-of-lunches/chapter-11/14

(...) 
cd ch11/exercises/infrastructure      # start the app with Linux containers:   docker-compose -f docker-compose.yml -f docker-compose-linux.yml up -d      # OR start with Windows containers:   docker-compose -f docker-compose.yml -f docker-compose-windows.yml up -d      # add registry domain to local hosts file on Mac or Linux:   echo $'\n127.0.0.1 registry.local' | sudo tee -a /etc/hosts      # OR on Windows:   Add-Content -Value "127.0.0.1 registry.local" -Path /windows/system32/drivers/etc/hosts      # check containers:   docker container ls
(...)
# docker-compose.yml   services:     jenkins:         image: diamol/jenkins         ports:             - "8080:8080"         networks:             - infrastructure      # docker-compose-linux.yml   jenkins:     volumes:         - type: bind             source: /var/run/docker.sock             target: /var/run/docker.sock      # docker-compose-windows.yml   jenkins:     volumes:         - type: npipe             source: \\.\pipe\docker_engine               target: \\.\pipe\docker_engine
(...) 
services:     numbers-api:         image: ${REGISTRY:-docker.io}/diamol/ch11-numbers-api:v3-build-${BUILD_NUMBER:-local}         networks:             - app-net        numbers-web:         image: ${REGISTRY:-docker.io}/diamol/ch11-numbers-web:v3-build-${BUILD_NUMBER:-local}         environment:             - RngApi__Url=http://numbers-api/rng         networks:               - app-net

(...) 
cd ch11/exercises      # build both images:   docker-compose -f docker-compose.yml -f docker-compose-build.yml build      # check the labels for the web image:   docker image inspect -f '{{.Config.Labels}}' diamol/ch11-numbers-api:v3-build-local
(...) 

No comments: