I'm trying to use the .env
file to set some variables on my docker-compose.yml
like it's described here : and I'm not able to make it work. I tried exactly the same example from the doc and I keep getting the same error:
WARNING: The TAG variable is not set. Defaulting to a blank string.
This is the part of my docker-compose.yml
where I use the variable:
version: '2.0'
services:
mariadb-service:
container_name: database-container
image: mariadb:${TAG}
And this is my .env
file:
TAG=10.1
I have docker-compose version 1.6.0.
only docker compose 1.7+ has supported .env
file. You need to update docker-compose
you can check you version docker-compose -v
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.