It is so slow inside the container to run a docker app, more than 1 minute while the same docker app runs in the host takes only 0.02 seconds, is this same to other docker images?
I assume that the issue here is that it takes time to read the files and launch node:boron. It’s about 1GB of files?
You can try some other benchmark (like with ab that makes many HTTP requests) to see how well node:boron responds after it has been launched.
The main source of the problem appears to be the choice of the storage driver for Docker, when it runs inside an LXD container. With docker info, we get
You are right, the issue is the storage, hello-world is so small, running it inside container or in the host has almost the same time elapsed, question now is, how to instruct the docker to use a faster storage driver? I believe apps packaged with docker usually has more than 100MB in size:
node boron e8c6ec267732 9 days ago 662 MB
hello-world latest 725dcfab7d63 2 weeks ago 1.84 kB
A workaround is to get LXD to use the btrfs storage backend, as described at https://github.com/lxc/lxd/issues/2305
Then, Docker-in-LXD will be able to use as well btrfs for its storage driver.
An LXD storage backend of ZFS makes docker to use the vfs Docker storage driver, which is not optimal.