OpenMLDB icon indicating copy to clipboard operation
OpenMLDB copied to clipboard

Reduce the size of docker image

Open Shouren opened this issue 5 years ago • 2 comments

Problem

The size of docker image of OpenMLDB currently provided on docker hub is too large compare to MySQL or PostgresQL (100MB+ vs 2.2GB). It takes nearly 1 and half hour to pulling it from docker hub.

After digging into the image(the output of du below), i found that the spark-3.0.0-bin-openmldb directory takes nearly 77% of the space and a Python script named openmldb_batch.py depends on it.

[root@7f8f08523050 work]# du -h -d 1
2.3M	./taxi-trip
1.7G	./openmldb
62M	./zookeeper-3.4.14
1.8G	.
[root@7f8f08523050 work]# cd openmldb/
[root@7f8f08523050 openmldb]# dh -h -d 1
bash: dh: command not found
[root@7f8f08523050 openmldb]# cd ..
[root@7f8f08523050 work]# ls
develop_ml_application_tour.ipynb  openmldb  taxi-trip	zookeeper-3.4.14
[root@7f8f08523050 work]# du -h -d 1
2.3M	./taxi-trip
1.7G	./openmldb
62M	./zookeeper-3.4.14
1.8G	.
[root@7f8f08523050 work]# cd openmldb/
[root@7f8f08523050 openmldb]# du -h -d 1
72K	./tools
16K	./conf
1.2G	./batch
488M	./bin
1.7G	.
[root@7f8f08523050 openmldb]# cd batch/spark-3.0.0-bin-openmldb/
[root@7f8f08523050 spark-3.0.0-bin-openmldb]# du -h -d 1
352K	./licenses
4.0M	./examples
1.1M	./data
10M	./yarn
40K	./conf
802M	./python
120K	./bin
405M	./jars
88K	./sbin
1.2G	.

However, there should be an image for those who just want to play with OpenMLDB itself rather than the taxi-trip demo.

Another reason for a smaller image is that develops may use OpenMLDB image as a base image to build their own app image, so there should be an image to meet this requirement.

Solution

My suggestion is providing two images named openmldb and openmldb-demo.

The openmldb image should contains minimal requirement to bring up a OpenMLDB instance. With binary, script and SDK inside the image, i hope the size the image would be no more than 600MB. The openmldb-demo should contains the content of taxi-trip demo as the current openmldb on docker hub.

Shouren avatar Aug 31 '21 14:08 Shouren

that's true, currently openmldb image is a demo, not minimal image like postgres

aceforeverd avatar Sep 01 '21 06:09 aceforeverd