无法使用冒号映射泊坞窗卷

时间:2017-07-06 00:48:06

标签: docker mount colon

当主机目录路径包含冒号时,有没有办法将主机目录挂载为数据卷? 实施例

{
    car: {
        make: "Honda",
        model: "Civic",
        year: 2017,
        trim: "EX"
    },
    market: {
        new: {
            min: 'overall min',
            max: 'overall max',
            data: [{
                seller:{
                    name: "John",
                    last: "Smith",
                    phone: "xxx-xxx-xxxx",
                    email: "email@domain.com",
                },
                car: {
                    price: 15000,
                    color: "white",
                    condition: "used",
                    notes: "Some notes about the car"
                }
            }]
        },
        used: { 
            min: 'overall min',
            max: 'overall max',
            data: [{
                seller:{
                    name: "John",
                    last: "Smith",
                    phone: "xxx-xxx-xxxx",
                    email: "email@domain.com",
                },
                car: {
                    price: 15000,
                    color: "white",
                    condition: "new",
                    notes: "Some notes about the car"
                }
            }]
        }
    }
}

在这种情况下,它将-v /colon:path/test:data 视为附加选项。 data是一个正确的Unix路径。

1 个答案:

答案 0 :(得分:2)

是。使用--mount选项,您可以指定源和目标。此选项已添加到Docker 17.05.0。

--mount type=bind,source=/colon:path/test,destination=/data

注意:您必须使用绝对路径名。我假设目的地是/ data。

来自docker run联机帮助页:

  

另请参阅--mount,它是--tmpfs和--volume的后继者。   即使没有计划弃用--volume,使用--mount   推荐。

示例:

touch foo:bar
docker run --rm --mount type=bind,source=$PWD/foo:bar,destination=/tmp/foo:bar busybox ls /tmp
相关问题