Sorry, I'm closing this one with the same message:
You need to have a running Docker daemon in your environment. Your example is incorrect - it does not communicate with Docker daemon.
But if you put RUN docker run hello-world, you will see that there is no docker running.
You code simply prints Docker client's version.
There might be other container tools that might allow this use case, but Testcontainers will only support Docker for the foreseeable future. While the use case is a very valid one (e.g. CI pipeline as part of the Docker multi-stage build), we can't support this, as long as Docker doesn't support it.
The linked docs describe how to use Testcontainers inside a running container, not during a docker build.