Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.6k views
in Technique[技术] by (71.8m points)

mac os docker build dockerfile volume 目录创建失败?

FROM ubuntu:16.04
VOLUME ["/root/share1","/root/share2"]

docker build -f ./dockerfile -t ubuntu-volume-test:16.04 .

docker inspect 之后的结果,容器内的share1,share2创建完成,可是我的机器的目录竟然没有创建,Volumes字段是空的

    "Config": {
        "Hostname": "53f0d054bf0b",
        "Domainname": "",
        "User": "",
        "AttachStdin": true,
        "AttachStdout": true,
        "AttachStderr": true,
        "Tty": true,
        "OpenStdin": true,
        "StdinOnce": true,
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "Cmd": [
            "/bin/sh",
            "-c",
            "/bin/bash"
        ],
        "Image": "ubuntu-volume-test:16.04",
        "Volumes": {
            "/root/share1": {},
            "/root/share2": {}
        },
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": {}
    },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

image 里不会有本机目录。

本机得在 docker run 的时候指定。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...