Docker未挂载主机文件

时间:2016-03-14 20:47:35

标签: docker permissions

我正在尝试使用here中的泊坞窗图片来开始设置数据科学设置。我可以使用

让docker挂载容器
docker run -d --privileged=true -p 8888:8888 --name ipyn3 -v /home/repos/DoSomeData/:/home/ds/notebooks/ dataquestio/python3-starter

其中主机目录“DoSomeData”包含目前“Hillary_Emails”的单个文件夹,其中包含输入数据目录和单个iPython Notebook文件。

当我进入ipython笔记本时,它可以看到“Hillary_Emails”目录,但没有别的。当我使用Bash登录容器并运行ls时也是如此。它似乎只是复制目录。 正在运行docker inspect ipyn3

[
{
    "Id": "b1cbba654135d46170e78c8ac522601ee743e1b1d3959b10fc7784c57c696433",
    "Created": "2016-03-14T20:20:24.413863418Z",
    "Path": "/home/ds/run_ipython.sh",
    "Args": [],
    "State": {
        "Status": "running",
        "Running": true,
        "Paused": false,
        "Restarting": false,
        "OOMKilled": false,
        "Dead": false,
        "Pid": 7629,
        "ExitCode": 0,
        "Error": "",
        "StartedAt": "2016-03-14T20:20:25.344852732Z",
        "FinishedAt": "0001-01-01T00:00:00Z"
    },
    "Image": "sha256:3cccab0c85e256d355fd7facbf3b897363bb72f7089ce7d65c54fe55b69ea25d",
    "ResolvConfPath": "/var/lib/docker/containers/b1cbba654135d46170e78c8ac522601ee743e1b1d3959b10fc7784c57c696433/resolv.conf",
    "HostnamePath": "/var/lib/docker/containers/b1cbba654135d46170e78c8ac522601ee743e1b1d3959b10fc7784c57c696433/hostname",
    "HostsPath": "/var/lib/docker/containers/b1cbba654135d46170e78c8ac522601ee743e1b1d3959b10fc7784c57c696433/hosts",
    "LogPath": "/var/lib/docker/containers/b1cbba654135d46170e78c8ac522601ee743e1b1d3959b10fc7784c57c696433/b1cbba654135d46170e78c8ac522601ee743e1b1d3959b10fc7784c57c696433-json.log",
    "Name": "/ipyn3",
    "RestartCount": 0,
    "Driver": "devicemapper",
    "MountLabel": "",
    "ProcessLabel": "",
    "AppArmorProfile": "",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": [
            "/home/repos/DoSomeData/:/home/ds/notebooks/"
        ],
        "ContainerIDFile": "",
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "NetworkMode": "default",
        "PortBindings": {
            "8888/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "8888"
                }
            ]
        },
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "VolumeDriver": "",
        "VolumesFrom": null,
        "CapAdd": null,
        "CapDrop": null,
        "Dns": [],
        "DnsOptions": [],
        "DnsSearch": [],
        "ExtraHosts": null,
        "GroupAdd": null,
        "IpcMode": "",
        "Links": null,
        "OomScoreAdj": 0,
        "PidMode": "",
        "Privileged": true,
        "PublishAllPorts": false,
        "ReadonlyRootfs": false,
        "SecurityOpt": null,
        "UTSMode": "",
        "ShmSize": 67108864,
        "ConsoleSize": [
            0,
            0
        ],
        "Isolation": "",
        "CpuShares": 0,
        "CgroupParent": "",
        "BlkioWeight": 0,
        "BlkioWeightDevice": null,
        "BlkioDeviceReadBps": null,
        "BlkioDeviceWriteBps": null,
        "BlkioDeviceReadIOps": null,
        "BlkioDeviceWriteIOps": null,
        "CpuPeriod": 0,
        "CpuQuota": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "Devices": [],
        "KernelMemory": 0,
        "Memory": 0,
        "MemoryReservation": 0,
        "MemorySwap": 0,
        "MemorySwappiness": -1,
        "OomKillDisable": false,
        "PidsLimit": 0,
        "Ulimits": null
    },
    "GraphDriver": {
        "Name": "devicemapper",
        "Data": {
            "DeviceId": "57",
            "DeviceName": "docker-253:0-2228497-91a65d788ceb1e1ed5a1ec339d19ba8de24ec574fad57982f6d939ec572df526",
            "DeviceSize": "10737418240"
        }
    },
    "Mounts": [
        {
            "Source": "/home/repos/DoSomeData",
            "Destination": "/home/ds/notebooks",
            "Mode": "",
            "RW": true,
            "Propagation": "rprivate"
        }
    ],
    "Config": {
        "Hostname": "b1cbba654135",
        "Domainname": "",
        "User": "ds",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "ExposedPorts": {
            "8888/tcp": {}
        },
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "TERM=xterm",
            "LANG=en_US.UTF-8",
            "HOME=/home/ds",
            "SHELL=/bin/bash",
            "USER=ds"
        ],
        "Cmd": [
            "/home/ds/run_ipython.sh"
        ],
        "Image": "dataquestio/python3-starter",
        "Volumes": {
            "/home/ds/notebooks": {}
        },
        "WorkingDir": "/home/ds/notebooks",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": {},
        "StopSignal": "SIGTERM"
    },
    "NetworkSettings": {
        "Bridge": "",
        "SandboxID": "84a7df65aa857432cc7bfcb7c28016eb40eee10c9a6eaf30c46fec3b69f2f673",
        "HairpinMode": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Ports": {
            "8888/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "8888"
                }
            ]
        },
        "SandboxKey": "/var/run/docker/netns/84a7df65aa85",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "EndpointID": "c8fe87fc450a97422439751ae1400f44c28656a81375788be214d4b5c7b70686",
        "Gateway": "172.17.0.1",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "172.17.0.2",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "MacAddress": "02:42:ac:11:00:02",
        "Networks": {
            "bridge": {
                "IPAMConfig": null,
                "Links": null,
                "Aliases": null,
                "NetworkID": "7c709634cd55286747ac4080457e57290db1cdc774d290f59727436223ecf08a",
                "EndpointID": "c8fe87fc450a97422439751ae1400f44c28656a81375788be214d4b5c7b70686",
                "Gateway": "172.17.0.1",
                "IPAddress": "172.17.0.2",
                "IPPrefixLen": 16,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "MacAddress": "02:42:ac:11:00:02"
            }
        }
    }
}
]

有谁知道造成这种情况的原因是什么?我正在运行Fedora23,这是我第一次尝试使用docker容器。它与权限的传播方式有关吗?

由于

1 个答案:

答案 0 :(得分:1)

我在docker inspect ipyn3工作时跑了。问题是源路径在主机之后需要我的用户名,即

\home\user_name\repos\DoSomeData