I'm trying to post docker image downloading status to frontend in a real time manner. Currently it can just tell that docker pull is going on. I understand that there could be multiple layers of different sizes and the sizes of layers that haven't started downloading could be unknown. So I'm thinking about showing how many layers are there and the current downloading status of the layers that have already started downloading.
Do you know how to capture the data that's shown on terminal console when you do docker pull <image>
? My program is in Python so that I would like to get the data in python code and send it to frontend. I checked the docker documentation but didn't find any api that supports this. Looks like there's no public api that supports this functionality yet.
Do you have any other approaches that may realize my goal?
Any suggestions are welcomed and appreciated!
Thank you!
You need a low-level
pull()
call for that (docs). Here's an example: