Docker Compose V2
I found out in a bad way that Docker Compose V2 exists. It is both a good thing and a bad thing.
What happened to V1?
So V1 of Docker Compose is a Python based tool. It shows that is being developed for the last 7 years. It has matured and gone through many iterations supporting many configurations and situations. It has been replaced by the V2, which has been in development for the last year or so.
The idea was to subsume the compose
command in the docker
cli one. Which is a good thing.
The good
The good things about this move are that it is officially taken into the docker
cli command and that means it will run out of the box everywhere and you only need one CLI binary. This is because it will be written in Golang which means it can be cross compiled as a standalone binary which is great.
No more also needing Python by default almost to support Docker Compose.
The bad
The bad is that it does not have feature parity with the V1. For instance, there is an automatic loading of environment values by using the .env
file loaded with for example:
AUTHOR=StealthyCoder
Then you can reference that in the docker-compose.yml
file by using it as a value like so: ${AUTHOR}
. This is great. Only I used .env
as a directory holding many environment variables depending on whether you are local or inside CircleCI for example.
The new V2 just dies on this. It spits out, .env is a directory
and stops. That is it. It took me only moments to realize this after I asked the person in question to give me the docker-compose version
output. It said 2.0.0-RC3 and I knew something was off.
This is not the only thing I ran into. There were also some weird DNS/Networking issues on MacOSX and these all seemed to be already logged in the Issues list.
Conclusion
It takes a long while to rebuild something. Even longer to rebuild correctly on first try and release. What could have happened better? Difficult to say, but a simple check to see what happens in the V1 when .env
is a directory and copy that behaviour should have been trivial, especially after a year of development.
Fix was easy. I just renamed it to .environment
and done. So not that mad. Well a bit with the DNS issues. I could not get around it with either giving it specific extra DNS resolvers, 9.9.9.9, so I basically did a try this otherwise succeed anyway trick.