Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker: create named docker volumes from images instead of unnamed vo…
…lumes from --volumes-from * create a proper volume instead of creating intermediate container from image and then using --volumes-from * running dev or runtime apollo container leaves a bunch of unnamed volumes: $ docker volume ls DRIVER VOLUME NAME local 5c20d4ed0f6a2dfca8cba1e182d8e74327d409be50925156e6ae35b8a803547d local 8a3105c9c0d613512f73c3b3fdb6117b55051f69a58b7daa05979a6587fd18ea local 8ce888434e441d9d68775be6bf962d6950fb4f6590aea6deb29d622b5c4f3958 local 55c7ad8291648fd446b3cdab389361f81e214c66c5295d84a5499abed6b8fd00 local 0715f504c2745f85a0c5b1d6cc983395da93f8fe7bca5f066f4265421656d557 local 0757b2c39394975b5e5ecc2edc6da4c03ff2747fc15eb373dc7754d6f58dcb06 local 0348328d88b9c15fc153045ebd291f067688f9f6fe9f2c71dfe76c9651543ee4 local 430718d15fa688cbfd42099c7f8886e8b1246dafd11ae56a1b65a54bffe77a5f local a41b4a8ba3b4eba78393224635f657f01b71d20994c5c4293262b07f1cdec8d3 local aa2874fe10829f7e12017616657f8eee2d916b1118eb3bb7469460e4dcb1c6c0 local aace6d89958015ea610445760b6d5d90b4930398eb2d58ad405aa0a580b915e1 local cfc3394ea18bc356e429089269c6b04df2ca800056b030195c02b3db29bafdb7 local e9d4100f63d28d9b519312a8b024d5102271b006278bca79b1a23d6b1a145cbd local ebecb4233da0c79fb193ab244a371606fdc2922645aa117d88ecd7a2e0271087 local edf30ff61831825429177a12720798c394d37338e259a9f46eb5583de6531daf local f2ad70033de87dd370291000258ad4108e582142250406157458f1ccc5115fa2 ... which even docker inspect doesn't really help to identify what they are and what container is using these possibly the easies way to find out what is using them is to try to remove them which shows an error listing the containers which use them: $ docker volume rm f2ad70033de87dd370291000258ad4108e582142250406157458f1ccc5115fa2 Error response from daemon: remove f2ad70033de87dd370291000258ad4108e582142250406157458f1ccc5115fa2: volume is in use - [f376385ab7155ba5ccc389a4289e6c56ebda317ecaf3bf4bd0894e1b9129ab52, 3d33606654fc2046582a925688da206a75fd45fca76529988f38cec8396b0900] $ docker inspect f376385ab7155ba5ccc389a4289e6c56ebda317ecaf3bf4bd0894e1b9129ab52 |grep Image.*apollo "Image": "apolloauto/apollo:map_volume-sunnyvale_big_loop-latest", $ docker inspect 3d33606654fc2046582a925688da206a75fd45fca76529988f38cec8396b0900 |grep Image.*apollo "Image": "apolloauto/apollo:runtime-x86_64-18.04-20210202_1232", create a volumes as described in: https://stackoverflow.com/questions/38700606/how-to-create-data-volume-from-image-for-use-in-nginx-container the only disadvantage is that now the script needs to know the mount path for these volumes, but for maps it's easy and for other volumes it doesn't seem to change * after this change the volumes have names: $ docker volume ls DRIVER VOLUME NAME local apollo_audio_volume_martin local apollo_faster_rcnn_volume_martin local apollo_map_volume-san_mateo_martin local apollo_map_volume-sunnyvale_big_loop_martin local apollo_map_volume-sunnyvale_loop_martin local apollo_map_volume-sunnyvale_with_two_offices_martin local apollo_smoke_volume_martin local apollo_yolov4_volume_martin and there is only one container running: $ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d3b24c9e99ab apolloauto/apollo:dev-x86_64-18.04-20210204_2153 "/bin/bash" 44 seconds ago Up 43 seconds apollo_dev_martin Signed-off-by: Martin Jansa <[email protected]>
- Loading branch information