Makefile无法在NFS上扩展文件*通配符

时间:2018-09-25 18:07:18

标签: docker makefile nfs macos-high-sierra vmware-fusion

我有以下设置:

  • Ubuntu LTS来宾
  • 运行MacOS 10.13.5(17F77)的MacBook Pro
  • 管理程序是VMware Fusion Professional版本8.5.9(7098239)
  • NFS从MacBook主机导出到Ubuntu来宾

这是/etc/exports中的相关行:

/Users/stephenrasku/w/Edge-Agent -alldirs -mapall=501:20 edgeos-dev

我有以下Makefile

build:
    ls -l
    ls -l foo*

当我在NFS挂载的i386容器中运行它时,它将失败。我正在运行VMware Fusion:

$ docker run --rm -t -v /home/stephen/some-nfs-mount:/home/edge registry.gear.ge.com/predix_edge/edge-agent-i386 "cd tmp && make"
Setting uid/gid to 501 501
ls -l
total 4
-rw-r--r-- 1 builduser builduser 26 Sep 25 17:58 Makefile
-rw-r--r-- 1 builduser builduser  0 Sep 25 17:58 bart
-rw-r--r-- 1 builduser builduser  0 Sep 25 17:58 fool
ls -l foo*
ls: cannot access 'foo*': No such file or directory
Makefile:2: recipe for target 'build' failed
make: *** [build] Error 2

如果我将存储库克隆到本机文件系统并将其绑定安装到容器中,则i386容器将起作用:

$ docker run --rm -t -v /home/stephen/this-directory-is-not-nfs:/home/edge registry.gear.ge.com/predix_edge/edge-agent-i386 "cd tmp && make"
Setting uid/gid to 501 501
ls -l
total 8
-rw-rw-r-- 1 builduser builduser 971 Sep 26 14:21 Dockerfile-i386
-rw-rw-r-- 1 builduser builduser  26 Sep 26 15:06 Makefile
-rw-rw-r-- 1 builduser builduser   0 Sep 26 14:21 bart
-rw-rw-r-- 1 builduser builduser   0 Sep 26 14:21 fool
ls -l foo*
-rw-rw-r-- 1 builduser builduser 0 Sep 26 14:21 fool

如果我在x86_64容器中运行,它也可以在NFS上运行:

$ docker run --rm -t -v /home/stephen/some-nfs-mount:/home/edge registry.gear.ge.com/predix_edge/edge-agent-x86_64 "cd tmp && make"
Setting uid/gid to 501 501
ls -l
total 4
-rw-r--r-- 1 builduser builduser 26 Sep 25 17:58 Makefile
-rw-r--r-- 1 builduser builduser  0 Sep 25 17:58 bart
-rw-r--r-- 1 builduser builduser  0 Sep 25 17:58 fool
ls -l foo*
-rw-r--r-- 1 builduser builduser 0 Sep 25 17:58 fool

i386容器是FROM i386/ubuntu:18.04,而x86_64容器是FROM ubuntu:18.04

除了“不使用NFS”之外,还有其他方法可以解决此问题吗?

1 个答案:

答案 0 :(得分:1)

外壳上的i386图像声音通配符功能已被禁用。

尝试set +o noglob为您的registry.gear.ge.com/predix_edge/edge-agent-i386启用它。

一些类似的试验,仅供参考。

# set -o noglob
# ls Doc*
ls: cannot access Doc*: No such file or directory
# set +o noglob
# ls Doc*
Dockerfile