rm -rf /run/kolla/log
docker run -it --rm -v /run/kolla/log:/dev/log centos ls -alh /dev/log
OK, but /dev/log will be a folder
rm -rf /run/kolla/log
docker run -it --rm -v /dev:/dev centos ls -alh /dev/log
OK, the /dev/log will be the same with the host /dev/log ( just mount bind)
rm -rf /run/kolla/log
docker run -it --rm -v /dev:/dev -v /run/kolla/log:/dev/log centos ls -alh /dev/log
Error, this is the issue case.
rm -rf /run/kolla/log
touch /run/kolla/log
docker run -it --rm -v /dev:/dev -v /run/kolla/log:/dev/log centos ls -alh /dev/log
OK. the /dev/log is the same with the host /run/kolla/log( a normal file, just mount bind)
conclusion: ( Mostly are guess, I am not familiar with the docker source code)
when mounting, if the inner mount point is a file, and the outer mount point is a a folder(or not exist), the mount will be failed.
It should be like this
mkdir a
touch b
touch c
mount --bind b c # OK
mount --bind a c # Failed
@elemonie
rm -rf /run/kolla/log log:/dev/ log centos ls -alh /dev/log
docker run -it --rm -v /run/kolla/
OK, but /dev/log will be a folder
rm -rf /run/kolla/log
docker run -it --rm -v /dev:/dev centos ls -alh /dev/log
OK, the /dev/log will be the same with the host /dev/log ( just mount bind)
rm -rf /run/kolla/log log:/dev/ log centos ls -alh /dev/log
docker run -it --rm -v /dev:/dev -v /run/kolla/
Error, this is the issue case.
rm -rf /run/kolla/log log:/dev/ log centos ls -alh /dev/log
touch /run/kolla/log
docker run -it --rm -v /dev:/dev -v /run/kolla/
OK. the /dev/log is the same with the host /run/kolla/log( a normal file, just mount bind)
conclusion: ( Mostly are guess, I am not familiar with the docker source code)
when mounting, if the inner mount point is a file, and the outer mount point is a a folder(or not exist), the mount will be failed.
It should be like this
mkdir a
touch b
touch c
mount --bind b c # OK
mount --bind a c # Failed