Is docker build secure

As long as you cannot run indefinitely and do a timeout, this is fine. I do not consider this an attack.