简体   繁体   English

Docker不同步主机文件夹(Windows)

[英]Docker not syncing hosts folder (Windows)

When I share a folder between my host and my containers, my files edited in Sublime are not syncing inside the containers. 当我在主机和容器之间共享文件夹时,在Sublime中编辑的文件不会在容器内同步。

I'm using Docker version 1.13.0, build 49bf474 and I tried many fixes that some issues on github told me to do, but none of them worked for me. 我正在使用Docker版本1.13.0,版本49bf474,我尝试了许多修复程序,这些修复程序是github上的某些问题让我做的,但没有一个对我有用。

I'm sharing my C/ driver with docker host, configuring my compose like this: 我正在与docker主机共享我的C /驱动程序,像这样配置我的撰写:

uwsgi: build: . uwsgi:构建:。 links: - postgres command: ./uwsgi.sh env_file: .env volumes: - /static - /data/media:/media - ./api:/app 链接:-postgres命令:./ uwsgi.sh env_file:.env卷:-/ static-/ data / media:/ media-./api:/app

My volume ./api:/app works, but when i change something, its not reflects on the container and I can't use for development. 我的体积./api:/app有效,但是当我更改某些内容时,它不会反映在容器上,因此无法用于开发。

Here is my inspect for this container: (Mounts/Volumes) 这是我对此容器的检查:(安装/体积)

"Mounts": [
        {
            "Type": "bind",
            "Source": "/C/Users/tif/projetos/my/jl.api/api",
            "Destination": "/app",
            "Mode": "rw",
            "RW": true,
            "Propagation": ""
        },
        {
            "Type": "bind",
            "Source": "/data/media",
            "Destination": "/media",
            "Mode": "rw",
            "RW": true,
            "Propagation": ""
        },
        {
            "Type": "volume",
            "Name": "b931d6d30c2b8e1bcdc2a20d5e6d2c27dd515c5041d2ea64ca01b5dc08047879",
            "Source": "/var/lib/docker/volumes/b931d6d30c2b8e1bcdc2a20d5e6d2c27dd515c5041d2ea64ca01b5dc08047879/_data",
            "Destination": "/static",
            "Driver": "local",
            "Mode": "",
            "RW": true,
            "Propagation": ""
        }
    ],
    "Volumes": {
            "/app": {},
            "/media": {},
            "/static": {}
        },

This things I have already tried: 我已经尝试过的东西:

  • atomic_save: false (Sublime) atomic_save:false(崇高)
  • nginx.conf with sendfile off; 关闭sendfile的nginx.conf;

Someone have experienced this? 有人经历过吗?

After some research, I could see that I was using uWsgi for development environment, and I couldn't get my app reloading without the py-autoreload. 经过一些研究,我可以看到我在开发环境中使用了uWsgi,没有py-autoreload我就无法重新加载我的应用程序。

All i had to get done was start my uwsgi setting the py-autoreload to 2 and my app started to reloads. 我要做的就是启动uwsgi,将py-autoreload设置为2,然后我的应用程序开始重新加载。

I'm starting this command on docker now: 我现在在docker上启动以下命令:

"/usr/local/bin/uwsgi --socket :5000 --wsgi-file ......... --py-autoreload 2

Reading this could be useful if you are experiencing this issue: http://chase-seibert.github.io/blog/2014/03/30/uwsgi-python-reload.html 如果您遇到此问题,阅读这篇文章可能会很有用: http : //chase-seibert.github.io/blog/2014/03/30/uwsgi-python-reload.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM