gramineproject / gsc

Gramine Shielded Containers (Docker integration)
BSD 3-Clause "New" or "Revised" License
43 stars 34 forks source link

Cleaning up of docker images created during gsc process is not happening #124

Open anjalirai-intel opened 1 year ago

anjalirai-intel commented 1 year ago

Description of the problem

There are 2 dangling docker images are present after every workload graminization

Steps to reproduce

Graminize any workload Once it is done, you will see a final gsc image and 2 untagged images

Expected results

No untagged images, Cleanup should happen correctly

Actual results

| gsc-redis | 7.0.0x | 08a251a6a362 | 14 minutes ago | 750MB | | < none > | < none > | 331be109bac2 | 14 minutes ago | 750MB | | < none > | < none > | d0e4340ffa5f | 15 minutes ago | 1.58GB | | ubuntu | 18.04 | 8d5df41c547b | 8 days ago | 63.1MB | | redis | 7.0.0 | 53aa81e8adfa | 2 months ago | 117MB |

dimakuv commented 1 year ago

There is an --rm command-line option to gsc build command:

Doesn't it work?

jkr0103 commented 1 year ago

I have tested --rm and it doesn't work. Generally --rm is used to delete the container when that stops. GSC build and GSC signing have multistage build, also it's not the intermediate image. Hence this case needs to be handled explicitly. But there are pros and con removing these dangling images.

With dangling image generated by GSC build, next GSC build will be fast as it can use the last gramine built from dangling image. If we delete it, then GSC build will take time as gramine build will happen again from scratch. This can be handled by removing the multistage, and including the gramine build in final image itself, removing built directory to reduce image size.

dimakuv commented 1 year ago

@jkr0103 Thanks for explanation. So what is the proposed solution then?