colima
colima copied to clipboard
Allow to override the usage of delimiters in generated container names (default '-')
We face the issue that colima uses '-' as delimiter for container names, while the original docker-compose was using '_' as a delimiter. This leads to problems in teams that are working in an environment with heterogeneous operating systems. For us for example, mac users right now face errors in scripts that are relying on the previous container names like my-fancy-project_database_1
because colima would generate my-fancy-project-database-1
, while other team members using linux for example would still run fine with the old naming scheme. This can be fixed, if the container names would be hard coded in docker-compose.yml files for example:
my-fancy-container:
depends_on:
- database
ports:
- "127.0.0.1:0:8080"
# ⬇️ ⬇️ ⬇️ ⬇️ ⬇️
container_name: my-fancy-project-my-fancy-container-1
But as you can see in the example this may cause issues in case you want to scale that container for example like this:
docker-compose up --scale my-fancy-container=2
Therefore I would suggest to add something, maybe an environment variable, that overrides the delimiter behavior to be able to configure it to be the same for everyone, thus that the old container names with underscores still work / no code changes are needed. 🙏
It is nothing to do with Colima, rather it is due to updates to docker compose https://github.com/docker/compose/issues/9061.
Looks like the options you have is either to downgrade docker compose or use the --compatibility
flag.
Ok. The --compatiblity
flag did not yield the needed result (We're doing some dynamic port detection within an .envrc
and direnv.)
Thus making sure, everybody is using the same docker-compose version it is.
But thank you for the quick response!
I tested the flag and it worked for me. Bear in mind you need to delete and re-create the service(s)