Building applications using docker-compose is very useful because we can use it for creating all the images in Docker Swarm or Kubernetes environments. We just need a docker-compose file definition and the application components' code.
We have been using a static docker-compose file definition, but in many cases, we will use some variables to fulfill their values for specific needs. In fact, we could use variables in Dockerfiles as well, to complete the dynamic configurations at all levels.
Let's introduce some variables to our application's docker-compose.yaml file (we do this to allow different behaviors):
version: "3.7"
services:
lb:
build:
context: ./simplestlb
args:
alpineversion: "latest"
dockerfile: Dockerfile.custom
labels:
org.codegazers.dscription: "Test image"
image: ${dockerhubid}/simplest-lab:simplestlb
environment:
- APPLICATION_ALIAS=simplestapp...