Actual behavior
docker-compose switches between - and _ as a container name separator between releases.
Expected behavior
docker-compose must consistently use - as a container name separator.
Information
- Running with Docker Desktop 4.3.0 (71786) on Windows 11, with the WSL2 backend.
- Docker Compose V2 is checked in the settings. docker-compose version is v2.2.1.
- This seems to have appeared with the 4.3.0 update. It is not noticed unless you rebuild your environment. I.e. existing environments continue to use
- as the container name separator.
- I had the same issue a couple of months back. That time, it was also fixed with an update.
Steps to reproduce the behavior
- Sample docker-compose file:
version: '3.4'
services:
db:
image: postgres:latest
restart: always
ports:
- "127.0.0.1:1020:5432"
volumes:
- postgres:/var/lib/postgresql/data
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
postgres:
- Steps:
docker-compose -f docker-compose-test.yaml -p separator-test up
# creates separator-test_db_1
docker-compose -f docker-compose-test.yaml -p separator-test down
sudo wget -q https://github.com/docker/compose/releases/download/v2.2.1/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose-v2.2.1-gh
sudo ln -sf /usr/local/bin/docker-compose-v2.2.1-gh /usr/bin/docker-compose
docker-compose -f docker-compose-test.yaml -p separator-test up
# creates separator-test-db-1
docker-compose -f docker-compose-test.yaml -p separator-test down
sudo ln -sf /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-compose /usr/bin/docker-compose /usr/bin/docker-compose
Actual behavior
docker-compose switches between
-and_as a container name separator between releases.Expected behavior
docker-compose must consistently use
-as a container name separator.Information
-as the container name separator.Steps to reproduce the behavior