I know, serious people use Kubernetes, but all I had was three small containers to deploy to run my website, all on the same host, and hence I figured docker-compose would do. So I set it all up, created my docker-compose.yml YAML file, tried to deploy it - only to discover that on the deployment host some of the tags would not work, one of them being target.
So I spent the next few hours digging into it and, it turns out, some version of docker-compose read in all the tags they can interpret, while others only interpret the ones allowed in the version specified in the first line of the file:
version: "3.7"
services:
web:
build:
context: .
target: "web"
container_name: "web0"
wproxy:
build:
context: .
target: "wproxy"
container_name: "wproxy0"
ports:
- "80:80"
volumes:
- letsencrypt_data:/etc/letsencrypt
links:
- web
wproxy_s:
build:
context: .
target: "wproxy_s"
container_name: "wproxy_s0"
ports:
- "443:443"
volumes:
- letsencrypt_data:/etc/letsencrypt
- html_home:/var/www/html
links:
- web
volumes:
letsencrypt_data:
html_home:
Initially my file read:
version: "3"
When I changed to to its current form:
version: "3.7"
The issue went away.
So yes, docker-compose is a useful orchestration tool, allowing to consistently and easily deploy small containerized applications. Only remember: version does matter, make sure you specify the correct one.