gpt4 book ai didi

macos - Docker 1.9 卷未在 Mac OS 上更新。图片nginx

转载 作者:行者123 更新时间:2023-12-02 04:44:58 26 4
gpt4 key购买 nike

我正在尝试在 docker 容器上运行一个简单的网络应用程序。我想在容器上安装一个卷,该卷会根据我指定的 MacOs 文件夹中的内容动态更新。

它在添加和删除文件时有效,但是当我向文件添加一些内容并保存它时,我看不到容器上更新的内容。

知道发生了什么吗?

Docker 和 Docker 机器版本:

docker-machine version 0.5.1 (7e8e38e)
docDocker version 1.9.1, build a34a1d5

我运行以创建容器的命令:

docker run --name foo-nginx -v $PWD:/usr/share/nginx/html:ro -d -p 8080:80 nginx

Docker 检查容器:

[{
"Id": "385c6fcd0184476cc3b1dc95faac3763770785032284307f7a88f9b666137336",
"Created": "2015-11-23T16:18:32.120393359Z",
"Path": "nginx",
"Args": [
"-g",
"daemon off;"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 1398,
"ExitCode": 0,
"Error": "",
"StartedAt": "2015-11-23T16:21:03.511426525Z",
"FinishedAt": "2015-11-23T16:21:03.080734898Z"
},
"Image": "9fab4090484a840de49347c9c49597ab32df23ec26bb98d7a7ec24d59dff8945",
"ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/385c6fcd0184476cc3b1dc95faac3763770785032284307f7a88f9b666137336/resolv.conf",
"HostnamePath": "/mnt/sda1/var/lib/docker/containers/385c6fcd0184476cc3b1dc95faac3763770785032284307f7a88f9b666137336/hostname",
"HostsPath": "/mnt/sda1/var/lib/docker/containers/385c6fcd0184476cc3b1dc95faac3763770785032284307f7a88f9b666137336/hosts",
"LogPath": "/mnt/sda1/var/lib/docker/containers/385c6fcd0184476cc3b1dc95faac3763770785032284307f7a88f9b666137336/385c6fcd0184476cc3b1dc95faac3763770785032284307f7a88f9b666137336-json.log",
"Name": "/foo-nginx",
"RestartCount": 0,
"Driver": "aufs",
"ExecDriver": "native-0.2",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/Users/gobeltri/workspace/foo-docker:/usr/share/nginx/html:ro"
],
"ContainerIDFile": "",
"LxcConf": [],
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"KernelMemory": 0,
"CpuShares": 0,
"CpuPeriod": 0,
"CpusetCpus": "",
"CpusetMems": "",
"CpuQuota": 0,
"BlkioWeight": 0,
"OomKillDisable": false,
"MemorySwappiness": -1,
"Privileged": false,
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "8080"
}
]
},
"Links": null,
"PublishAllPorts": false,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"VolumesFrom": null,
"Devices": [],
"NetworkMode": "default",
"IpcMode": "",
"PidMode": "",
"UTSMode": "",
"CapAdd": null,
"CapDrop": null,
"GroupAdd": null,
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"SecurityOpt": null,
"ReadonlyRootfs": false,
"Ulimits": null,
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"CgroupParent": "",
"ConsoleSize": [
0,
0
],
"VolumeDriver": ""
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [
{
"Source": "/Users/gobeltri/workspace/foo-docker",
"Destination": "/usr/share/nginx/html",
"Mode": "ro",
"RW": false
},
{
"Name": "737d1c59dc872f72530b54b80408292190453416c3768e4183ffab830a479878",
"Source": "/mnt/sda1/var/lib/docker/volumes/737d1c59dc872f72530b54b80408292190453416c3768e4183ffab830a479878/_data",
"Destination": "/var/cache/nginx",
"Driver": "local",
"Mode": "",
"RW": true
}
],
"Config": {
"Hostname": "385c6fcd0184",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.9.7-1~jessie"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"Image": "nginx",
"Volumes": {
"/var/cache/nginx": {}
},
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "749ea24857714fbdbb3390fc6e1bd21590f88f2b39b3a2acf176362cbe9bedcc",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"443/tcp": null,
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8080"
}
]
},
"SandboxKey": "/var/run/docker/netns/749ea2485771",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "2e64b98990ce42c3e5ec5c8d3fb55a759e96c0994d31003139856e2f628084a4",
"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": {
"EndpointID": "2e64b98990ce42c3e5ec5c8d3fb55a759e96c0994d31003139856e2f628084a4",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}

}]

最佳答案

关闭 Nginx 的 sendfile off 解决了这个问题。

发送文件关闭;

另见:
https://github.com/docker/docker/issues/15793 https://abitwiser.wordpress.com/2011/02/24/virtualbox-hates-sendfile/

关于macos - Docker 1.9 卷未在 Mac OS 上更新。图片nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33877652/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com