Closed cfeltz34 closed 3 years ago
No issue with docker compose 1.29.2
I just tested with rc3 and issue has been fixed it seems:
$ docker compose config
services:
rabbitmq:
container_name: example.rabbitmq
image: rabbitmq:3.8.9
(...)
$ rm .env
$ docker compose config
services:
rabbitmq:
container_name: example.rabbitmq
image: rabbitmq:management
(...)
$ RABBITMQ_VERSION=foo docker compose config
services:
rabbitmq:
container_name: example.rabbitmq
image: rabbitmq:foo
(...)
Please re-open if issue persist after upgrade to v2.0.0-rc.3
I still have the issue with rc3 but I don't know how to reopen the issue
.env
RABBITMQ_VERSION=3.8.9
docker-compose.test.rabbitmq.yml
version: '3.7'
services: rabbitmq: container_name: test.rabbitmq image: rabbitmq:$RABBITMQ_VERSION-management environment:
- RABBITMQ_DEFAULT_USER=RabbitMqUser
- RABBITMQ_DEFAULT_PASS=Pass@word34 volumes:
- rabbitmq-data:/var/lib/rabbitmq ports:
- 45672:5672
- 45674:15672 # managment plugin networks:
- network
volumes:
rabbitmq-data:networks: network:
Command :
docker-compose -p TestBug -f docker-compose.test.rabbitmq.yml up -d --build docker ps --> CONTAINER ID IMAGE
--> d6c0c157275b rabbitmq:3.8.9
This container should be based on rabbitmq:3.8.9-management and not on rabbitmq:3.8.9
I think I get it:
$RABBITMQ_VERSION-management
syntax actually means "variable RABBITMQ_VERSION, defaults to management
if not set" (see https://docs.docker.com/compose/environment-variables/#substitute-environment-variables-in-compose-files)
defining variable without explicit ${}
makes this syntax ambiguous, so the confusion here. Better use ${RABBITMQ_VERSION}-management
to make the variable boudaries explicit within this composed value
As a side-note, while docker-compose python only applies bash-style rules to braced variables, compose-go doesn't. I wonder this is something we should fix @ulyssessouza ?
I agree that it should only apply with the strict mode (the one with ${}
), otherwise that become ambiguous. Even the documentation only uses this notation. I can have a look at godotenv
to check how hard it is to distinguish between the 2 and apply the default.
Description of the issue
Context information (for bug reports)
Output of
docker(-)compose version
Output of
docker version
Steps to reproduce the issue