4 ms·
To start a container Docker does a lot of expensive setup like preparing network stack, volumes, logging etc. One can trivially see how expensive is that just b
by fpoling 9y ago
To start a container Docker does a lot of expensive setup like preparing network stack, volumes, logging etc. One can trivially see how expensive is that just by timing the command line and dropping expensive Docker options. On my laptop:
$ time docker run --rm ubuntu true
real 0m0.641s
user 0m0.036s
sys 0m0.018s
$ time docker run --rm --net none --log-driver none --read-only ubuntu true
real 0m0.399s
user 0m0.039s
sys 0m0.018s
Compare that with the unshare utility that one can use as a Docker replacement for simple containers (options create all new namespaces that the utility supports including user namespaces):
$ time unshare -m -u -i -n -p -U -C -f -r /bin/true
real 0m0.029s
user 0m0.001s
sys 0m0.009s