I just created a container from mariadb:latest image, got inside it and after executing lsblk I see for me strange output. The same partition (sda2 ) is mounted in the directory and files at the same time.
How is this possible in Linux? How this can be implemented in regular Linux OS?
Note: I also created a container from mysql:latest image, but the output is different (was not mounted on multiple paths)
those are bind mounts from host folders/files to container folders/files. This is normal.
You can try bind mounts on your host (outside docker): mount --bind {src folder} {target folder}
Of course the src and target folder must exist, as the src will be bind mounted into the target folder. As a result both folders will point to the same inode in the filesystem. I actualy never tried to bind mount a file to another file - as this usualy would be done with a symlink instead.
Update: rephrased some sentinces, after realizing some words where mixed up.