2

アプリケーションのビルドと実行に docker-compose を使用しています。

docker-compose.yml は次のとおりです。

db:
  image: postgres
web:
  build: .
  command: sh startup.sh
  volumes:
    - .:/code
  ports:
    - "8000:8000"
  links:
    - db

私の Dockerfile:

FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt-get install -y nginx 
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/

そのため、コマンドラインに移動して実行すると、そこに長時間docker-compose up留まり、最終的にスペースが不足したというエラーで終了します。Building web...vagrant vm には 40 GB があるため、そのすべてのスペースが占有される原因が何であるかはわかりません。

Pulling db (postgres:latest)...
latest: Pulling from postgres

902b87aaaec9: Pull complete
9a61b6b1315e: Pull complete
26a84c436db4: Pull complete
22ed955cce18: Pull complete
8b6b2a3b7f9c: Pull complete
c783ebe7a1d4: Pull complete
e07b5a739ed9: Pull complete
0b82f508e063: Pull complete
02fa71f1fa38: Pull complete
b41b53da5fba: Pull complete
49915906faae: Pull complete
a814508841fa: Pull complete
64957633c267: Pull complete
a95070c23e86: Pull complete
c5d75e7f9094: Pull complete
3fa84fbfdec9: Pull complete
39172f8b90f2: Pull complete
09e02a9f8afe: Pull complete
4df8a54cf33a: Pull complete
3e840dbb5474: Pull complete
730d1d72bda2: Already exists
postgres:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.

Digest: sha256:66ba100bc635be1746daadd3ecfa46b51fbb767cd9fbc170edbf33483010065b
Status: Downloaded newer image for postgres:latest
Creating webapp_db_1...
Building web...
Step 0 : FROM python:2.7
2.7: Pulling from python
1ff9f26f09fb: Pull complete
607e965985c1: Pull complete
9213e81cb0f2: Pull complete
0a18b31a754d: Pull complete
894736a966eb: Pull complete
169a877759a5: Pull complete
4d661b41bfe3: Pull complete
0c69eb1a3057: Pull complete
c5942c48e4c6: Pull complete
76e439c97b9c: Pull complete
e1857ee1f3b5: Already exists
902b87aaaec9: Already exists
9a61b6b1315e: Already exists
python:2.7: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:958cf6cce0a123875b9d04598a1927d92becc5cc0dae9bd5cf26ec821e2eda32
Status: Downloaded newer image for python:2.7
 ---> e1857ee1f3b5
Step 1 : ENV PYTHONUNBUFFERED 1
 ---> Running in daf17fb52804
 ---> 32f372e41634
Removing intermediate container daf17fb52804
Step 2 : RUN apt-get update && apt-get install -y nginx
 ---> Running in aa1170c05965
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://httpredir.debian.org jessie InRelease [134 kB]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [157 kB]
Get:4 http://httpredir.debian.org jessie-updates InRelease [123 kB]
Get:5 http://httpredir.debian.org jessie/main amd64 Packages [9038 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [3616 B]
Fetched 9519 kB in 8s (1155 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-rsvg-2.0
  libcairo-gobject2 libcairo-script-interpreter2 libcdt5 libcgraph6 libcroco3
  libdjvulibre-dev libelfg0 libexif-dev libexif12 libexpat1-dev
  libfontconfig1-dev libfreetype6-dev libgirepository-1.0-1 libglib2.0-bin
  libgraphviz-dev libgvc6 libgvpr2 libice-dev libice6 libilmbase-dev
  libjasper-dev libjbig-dev libjs-excanvas libjs-jquery liblcms2-dev
  liblqr-1-0-dev liblzo2-2 libmagickcore-6-arch-config libmagickcore-6-headers
  libmagickwand-6-headers libopenexr-dev libpathplan4 libpcre3-dev libpcrecpp0
  libpixman-1-dev libpng12-dev libpthread-stubs0-dev librsvg2-2
  librsvg2-common libsm-dev libsm6 libtiff5-dev libtiffxx5 libwmf-dev
  libx11-dev libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev
  libxdmcp-dev libxdot4 libxext-dev libxrender-dev libxt-dev libxt6
  mime-support pkg-config x11-common x11proto-core-dev x11proto-input-dev
  x11proto-kb-dev x11proto-render-dev x11proto-xext-dev xorg-sgml-doctools
  xtrans-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  geoip-database init-system-helpers libgeoip1 nginx-common nginx-full
Suggested packages:
  geoip-bin fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  geoip-database init-system-helpers libgeoip1 nginx nginx-common nginx-full
0 upgraded, 6 newly installed, 0 to remove and 7 not upgraded.
Need to get 2210 kB of archives.
After this operation, 6860 kB of additional disk space will be used.
Get:1 http://httpredir.debian.org/debian/ jessie/main libgeoip1 amd64 1.6.2-4 [90.8 kB]
Get:2 http://httpredir.debian.org/debian/ jessie/main init-system-helpers all 1.22 [14.0 kB]
Get:3 http://httpredir.debian.org/debian/ jessie/main geoip-database all 20150317-1 [1517 kB]
Get:4 http://httpredir.debian.org/debian/ jessie/main nginx-common all 1.6.2-5 [86.6 kB]
Get:5 http://httpredir.debian.org/debian/ jessie/main nginx-full amd64 1.6.2-5 [429 kB]
Get:6 http://httpredir.debian.org/debian/ jessie/main nginx all 1.6.2-5 [72.1 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 2210 kB in 2s (829 kB/s)
Selecting previously unselected package libgeoip1:amd64.
(Reading database ... 18873 files and directories currently installed.)
Preparing to unpack .../libgeoip1_1.6.2-4_amd64.deb ...
Unpacking libgeoip1:amd64 (1.6.2-4) ...
Selecting previously unselected package init-system-helpers.
Preparing to unpack .../init-system-helpers_1.22_all.deb ...
Unpacking init-system-helpers (1.22) ...
Selecting previously unselected package geoip-database.
Preparing to unpack .../geoip-database_20150317-1_all.deb ...
Unpacking geoip-database (20150317-1) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../nginx-common_1.6.2-5_all.deb ...
Unpacking nginx-common (1.6.2-5) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.6.2-5_amd64.deb ...
Unpacking nginx-full (1.6.2-5) ...
Selecting previously unselected package nginx.
Preparing to unpack .../archives/nginx_1.6.2-5_all.deb ...
Unpacking nginx (1.6.2-5) ...
Processing triggers for systemd (215-17+deb8u1) ...
Setting up libgeoip1:amd64 (1.6.2-4) ...
Setting up init-system-helpers (1.22) ...
Setting up geoip-database (20150317-1) ...
Setting up nginx-common (1.6.2-5) ...
Setting up nginx-full (1.6.2-5) ...
invoke-rc.d: policy-rc.d denied execution of start.
Setting up nginx (1.6.2-5) ...
Processing triggers for libc-bin (2.19-18) ...
Processing triggers for systemd (215-17+deb8u1) ...
 ---> b0c936818d0d
Removing intermediate container aa1170c05965
Step 3 : RUN mkdir /code
 ---> Running in cb513ddbaf65
 ---> c1cc5a5da673
Removing intermediate container cb513ddbaf65
Step 4 : WORKDIR /code
 ---> Running in d9ea2fb9e550
 ---> 059962be4b7d
Removing intermediate container d9ea2fb9e550
Step 5 : ADD requirements.txt /code/
 ---> fc1f1f9d63b9
Removing intermediate container 4380a58aef2d
Step 6 : RUN pip install -r requirements.txt
 ---> Running in e9db31e110aa
Collecting boto (from -r requirements.txt (line 1))
  Downloading boto-2.38.0-py2.py3-none-any.whl (1.3MB)
Collecting django-storages (from -r requirements.txt (line 2))
  Downloading django-storages-1.1.8.tar.gz
Collecting Django (from -r requirements.txt (line 3))
  Downloading Django-1.8.3-py2.py3-none-any.whl (6.2MB)
Collecting psycopg2 (from -r requirements.txt (line 4))
  Downloading psycopg2-2.6.1.tar.gz (371kB)
Building wheels for collected packages: django-storages, psycopg2
  Running setup.py bdist_wheel for django-storages
  Stored in directory: /root/.cache/pip/wheels/11/36/48/600ce18487aa34307973cf27d3004067f213dbba9df82e77c8
  Running setup.py bdist_wheel for psycopg2
  Stored in directory: /root/.cache/pip/wheels/e2/9a/5e/7b620848bbc7cfb9084aafea077be11618c2b5067bd532f329
Successfully built django-storages psycopg2
Installing collected packages: boto, django-storages, Django, psycopg2
Successfully installed Django-1.8.3 boto-2.38.0 django-storages-1.1.8 psycopg2-2.6.1
 ---> f64bc27b721e
Removing intermediate container e9db31e110aa
Step 7 : ADD . /code/
Service 'web' failed to build: Untar re-exec error: exit status 1: output: write /code/.vagrant/machines/default/vmware_fusion/b2b99ae2-136e-4f62-96cc-d562e4867f09/disk-s007.vmdk: no space left on device

Building web...何が最初に長い間ステップを踏んでいるのか誰か知っていますか? または、なぜマシン上のすべてのスペースを占有するのでしょうか。いくつかのパッケージと pip ライブラリのみをインストールしています。

4

1 に答える 1

2

mkdir xxx ; cd xxxDockerfile を作成する前にから始めましたか?

「コンテキストをアップロードしています」というメッセージがあったと思います。

https://github.com/docker/docker/issues/2342からの抜粋 "クライアントは、docker build を実行したディレクトリ (およびすべてのサブディレクトリ) を tar/compressing しています。ええ、そうです。これをルート ディレクトリで実行すると、 、ドライブ全体が tar され、docker デーモンに送信されます。」

于 2015-08-10T06:50:28.003 に答える