只读docker容器中现有目录上的可写tmpfs卷提供:只读文件系统
试图在docker中设置mysql容器,并将只读标志设置为安全性,但遇到以下错误: [错误]无法创建unix套接字锁文件/var/run/mysqld/mysqld.sock.lock 试图通过将/var/run/mysqld装载为tmpfs来缓解这个问题,但是,似乎只要容器是只读的,tmpfs装载也是只读的只读docker容器中现有目录上的可写tmpfs卷提供:只读文件系统,docker,containers,Docker,Containers,试图在docker中设置mysql容器,并将只读标志设置为安全性,但遇到以下错误: [错误]无法创建unix套接字锁文件/var/run/mysqld/mysqld.sock.lock 试图通过将/var/run/mysqld装载为tmpfs来缓解这个问题,但是,似乎只要容器是只读的,tmpfs装载也是只读的 docker run --read-only --mount type=tmpfs,destination=/var/run/mysqld,tmpfs-mode=1777 mysql:5
docker run --read-only --mount type=tmpfs,destination=/var/run/mysqld,tmpfs-mode=1777 mysql:5 touch /var/run/mysqld/test
touch: cannot touch '/var/run/mysqld/test': Read-only file system
使用卷装载而不是tmpfs是可行的,但这不是我想要做的:
docker run --read-only --mount destination=/var/run/mysqld mysql:5 touch /var/run/mysqld
在不存在的目录上测试它也可以:
docker run --read-only --mount type=tmpfs,destination=/test,tmpfs-mode=1777 mysql:5 touch /test/test
如果从容器中删除只读标志,则该功能将正常工作:
docker run --mount type=tmpfs,destination=/var/run/mysqld,tmpfs-mode=1777 mysql:5 touch /var/run/mysqld/test
这是出于设计还是一个bug,还是我缺少了一些设置?
Docker版本19.03.12,内部版本48a66213fe