启用卷时,无法启动任何容器Docker Toolbox

我在Windows 7 Pro Service pack 1 x64操作系统上运行Docker Toolbox v. 1.13.1a 。 与Virtual Box Version 5.1.14 r112924

当我尝试运行任何docker图像,例如来自Docker Hub的禁用卷的official postgres image ,它可以正常工作!

但是,当我enable the volumes 失败

我尝试了所有的官方文件

虚拟机具有共享文件夹根据需要,并具有full access它也共享文件夹的屏幕截图

在我的例子postgresql崩溃与以下log

 The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... LOG: could not link file "pg_xlog/xlogtemp.27" to "pg_xlog/000000010000000000000001": Operation not permitted FATAL: could not open file "pg_xlog/000000010000000000000001": No such file or directory child process exited with exit code 1 initdb: removing contents of data directory "/var/lib/postgresql/data" 

我知道它与folder permissions的问题。 但有点卡住了! 提前一吨谢谢

我一直忙于这个问题,我的结论是,目前根本无法在Docker容器中运行postgresql,同时将数据保持在一个单独的卷中。

我甚至尝试运行容器而不链接到一个卷,并将最初在/ var / lib / postgresql中的数据复制到我的主机操作系统(Windows 10 Home)的文件夹中,然后将复制到已链接到容器本身。

唉,我得到了下一个错误:

 FATAL: data directory "/var/lib/postgresql/data/pgadmin" has wrong ownership HINT: The server must be started by the user that owns the data directory. 

总之:所有权和正确的用户拥有它并且能够修复它是有问题的,您需要在Windows上运行docker的unix命令行(在Windows上Ubuntu上的Bash目前是不可能的这是运行使用Ubuntu 16.04二进制文件)。

也许,将来你可以运行所需的命令(在这里可以findArbitrary --user Notes ),但是这些是* nix命令,PowerShell(由Kitematic启动)不能运行这些命令。 对于Windows的Ubuntu的Bash 可以运行这些,但该shell没有连接到在Windows上的泊坞窗守护进程/服务…

TL; DR:失去了一天的工作:目前在Windows上是不可能的。

我一直在试图解决这个问题也..

起初我以为这是一个符号链接的问题(因为第一个错误失败“不能链接..操作不允许)

为了确保符号链接是允许的,你必须:

  1. 在virtualbox中共享一个文件夹
  2. 以pipe理员身份运行virtualbox(如果您的帐户在pipe理员组中)右键单击virtualbox.exe并select以pipe理员身份运行
  3. 如果您的帐户不是pipe理员,请使用secpol.msc >“本地策略 – 用户权限分配”添加符号链接特权将您的用户添加到“创build符号链接”
  4. 为virtualbox中的共享文件夹启用符号链接:

VBoxManage setextradata VM_NAME VBoxInternal2 / SharedFoldersEnableSymlinksCreate / SHARED_FOLDER_NAME 1

或者,也可以使用默认dockertools安装时启用的共享和符号链接的c:\User\username文件夹

现在我可以在docker容器的共享文件夹中创build符号链接..但我仍然有同样的错误“无法链接…操作不允许”

所以原因必须在其他地方…在文件权限,如你所说,但我不明白为什么?