I had to work around a docker design issue: we cannot use a static OR port or obfs4 port in the image because that would make it possible to scan the IPv4 address space for these ports and block all bridges you find that way. We therefore need random ports. Docker's build command has a -P switch that picks a random, external port and forwards it to an internal, static port but the issue is that the image has no easy way of learning what external port docker picked. Tor however needs to know because it has to advertise these ports in its descriptor.
My workaround is a shell script that automatically determines a random port and passes it to the image via environment variables. It's not pretty but it works.
This looks good to me. I left a small comment on one of the commits.
Thanks!
I informed tor-relays@ that we now have a docker image. Let's see if we get some feedback. Then, we can update our installation instructions with the docker image and move forward with #30777 (moved).
I made some improvements to the container creation progress starting in commit deeb0c83. The tor process now drops privileges and I removed the ugly sed string replacement hack. Could you please review these changes too?