服务大型数据集w / Docker,nginx和django

我正在研究一个涉及大型video数据集的研究项目(GB的数量为100,在不久的将来可能会有多个TB)。 我对Linux,系统pipe理员和设置服务器相当新,所以请耐心等待。 我提供了相当多的信息,让我知道是否还有其他任何有用的信息。

我使用的是Ubuntu,Docker(使用docker-compose),nginx,Python3.5和django 1.10

上传大数据(60GB)数据集导致以下错误:

$ sudo docker-compose build postgres uses an image, skipping Building django Step 1 : FROM python:3.5-onbuild # Executing 3 build triggers... Step 1 : COPY requirements.txt /usr/src/app/ ---> Using cache Step 1 : RUN pip install --no-cache-dir -r requirements.txt ---> Using cache Step 1 : COPY . /usr/src/app ERROR: Service 'django' failed to build: Error processing tar file(exit status 1): write /usr/src/app/media/packages/video_3/video/video_3.mkv: no space left on device 

我的文件在500GB空闲的驱动器上,而当前的数据集只有〜60GB。

我发现这个关于容器大小的讨论 。 也许我误解了Docker,但是我相信我只是希望我的卷更大,而不是容器本身,所以这看起来不合适。 它也不使用docker-compose,所以我不清楚如何在当前的设置中实现它。

只需要清楚,在这个问题的帮助下,我可以用一个小的testing数据集提供静态文件和媒体文件。 (我不清楚,如果他们是从Django的容器或Nginx的容器,因为数据出现在两个容器通过SSH)

我怎样才能让我的设置来处理这么多的数据呢? 我希望能够稍后上传更多的数据,所以如果有一个解决scheme可以做到这一点,而不必一直重build卷,那就会膨胀起来。

我的设置

目录结构

 film_web ├── docker-compose.yml ├── Dockerfile ├── film_grammar │  ├── #django code lives here ├── gunicorn_conf.py ├── media │  ├── #media files live here ├── nginx │  ├── Dockerfile │  └── nginx.conf ├── requirements.txt └── static ├── #static files live here 

泊坞窗,compose.yml

 nginx: build: ./nginx volumes: - ./media:/usr/src/app/film_grammar/media - ./static:/usr/src/app/film_grammar/static links: - django ports: - "80:80" volumes_from: - django django: build: . volumes: - ./film_grammar:/usr/src/app/film_grammar expose: - "8000" links: - postgres postgres: image: postgres:9.3 

film_web Dockerfile

 From python:3.5-onbuild ENV DJANGO_CONFIGURATION Docker CMD ["gunicorn", "-c", "gunicorn_conf.py", "--chdir", "film_grammar", "fg.wsgi:application", "--reload"] VOLUME /home/alexhall/www/film_web/static VOLUME /home/alexhall/www/film_web/media 

nginx Dockerfile:

 FROM nginx COPY nginx.conf /etc/nginx/nginx.conf 

nginx.conf

 worker_processes 1; events { worker_connections 1024; } http { include /etc/nginx/mime.types; server { listen 80; server_name film_grammar_server; access_log /dev/stdout; error_log /dev/stdout info; location /static { alias /usr/src/app/film_grammar/static/; } location /media { alias /usr/src/app/film_grammar/media/; } location / { proxy_pass http://django:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; } } } 

在此先感谢您的帮助!

build首先从上下文目录创build一个tarball(在你的情况下),然后将这个tarball发送到服务器。 我相信,在tmp目录中创build了tarball,这可能就是为什么当你尝试构build时你的空间不够用了。

当处理大型数据集时,推荐的方法是使用卷。 您可以使用绑定挂载卷来挂载主机中的文件。

由于您使用卷提供数据,因此您需要将其从图像上下文中排除。 要做到这一点在.dockerignore中创build. 目录。 在该文件中添加大数据( .gitmediastatic )的所有path。

一旦你忽略了大型目录的构build应该工作。

Interesting Posts