I just saw two Docker-related posts in my chimeline, so you'll have to listen to me be insufferable about Docker for just a second
When I say that Docker is not compositional, what I mean is that there is no way to combine an arbitrary number of containers into a single container. When you combine a bunch of Docker containers together you end up with … still a bunch of containers and now you need some higher-level abstraction to represent and manage a group of containers (e.g. docker compose, kubernetes / helm or what have you).
Even worse, these higher-level abstractions for working with groups of containers are still not composable (meaning that all of the attempts to solve this higher-level problem in the Docker ecosystem still managed to get this wrong). Given any of these abstractions (X) for working with groups of containers, they somehow keep failing to provide a way to combine an arbitrary number of Xs into a single X. It's just a comedy of errors because they keep getting this one simple thing wrong.
This is the key thing that the Nix language gets correct that Docker does not get correct. You can easily combine 0 or more Nix derivations to produce a new composite derivation which is as simple as its constituent parts. This is why the Nix ecosystem keeps growing quickly while the Docker ecosystem is straining under the tower of non-compositional abstractions they've created.
If this subject interests you, I wrote a blog post along these lines a while ago (albeit not specific to Docker or Nix):