我总是使用docker来部署我的django应用程序但是今天我遇到了问题。
这是docker-compose.yml文件中的uwsgi:
# Note you cannot scale if you use conteiner_name
container_name: catalogue-uwsgi
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- RABBITMQ_HOST=rabbitmq
- DJANGO_SETTINGS_MODULE=core.settings.prod_docker
- VIRTUAL_HOST=catalogue.kartoza.com
- VIRTUAL_PORT=8080
volumes:
- ../django_project:/home/web/django_project
- ./static:/home/web/static
- ./media:/home/web/media
- ./reports:/home/web/reports
- ./logs:/var/log/
- ./data:/home/web/django_project/data
links:
- smtp:smtp
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: on-failure:5
容器。
/EOSHARE/Karabo/CATALOGUE/thumbnails_cat3:/django_project/thumbs_out
一切正常,但我需要安装一个包含很多缩略图文件的目录。尺寸非常大。
我已将此行volumes
添加到ls
行。然后我重新部署容器。
问题是无法装入本地目录中的某些文件/目录。我不确定这个,这是我第一次体验我需要挂载大尺寸的目录。
这是我的分析:
这是目录的root@testenv:/EOSHARE/Karabo/CATALOGUE/thumbnails_cat3# ls
AQA cache E2 L3 L5 N11 N14 N16 N9 RE2 RE4 S1 S3 S5 S-C ZA2
C2B E1 L2 L4 L7 N12 N15 N17 RE1 RE3 RE5 S2 S4 SACC TER
root@testenv:/EOSHARE/Karabo/CATALOGUE/thumbnails_cat3#
:
本地目录:
root@uwsgi:/home/web/django_project/thumbs_out# ls
S1 S2 S4 S5 cache
Docker容器:
root@testenv:/home/web/catalogue/deployment# docker ps -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
f1380ac2e1f1 catalogue_uwsgi "python manage.py mig" 5 minutes ago Up 5 minutes 8080/tcp catalogue_uwsgi_run_119 283.4 kB (virtual 2.468 GB)
c18553c5141b nginx "nginx -g 'daemon off" 5 minutes ago Up 5 minutes 80/tcp, 443/tcp, 0.0.0.0:62080->8080/tcp catalogue-web 2 B (virtual 190.5 MB)
0bb98b3f4500 catalogue_uwsgi "uwsgi --ini /uwsgi.c" 5 minutes ago Up 5 minutes 8080/tcp catalogue-uwsgi 252.7 kB (virtual 2.468 GB)
b9166d6cfa8d catalogue_worker "celery worker -A cat" 8 days ago Up 8 days 8080/tcp catalogue_worker_1 373.2 kB (virtual 2.468 GB)
bd65f624cded library/rabbitmq "/docker-entrypoint.s" 8 days ago Up 8 days 4369/tcp, 5671-5672/tcp, 25672/tcp catalogue_rabbitmq_1 0 B (virtual 300.8 MB)
07f212b09ef8 kartoza/pg-backup:9.4 "/start.sh" 12 weeks ago Up 4 weeks 5432/tcp catalogue-db-backups 1.071 MB (virtual 497.9 MB)
d32576b47c75 catatnight/postfix "/bin/sh -c '/opt/ins" 12 weeks ago Up 4 weeks catalogue-smtp 11.42 MB (virtual 268 MB)
6404c753dbf8 kartoza/postgis:9.4-2.1 "/bin/sh -c /start-po" 12 weeks ago Up 6 days 5432/tcp catalogue-db 3.915 GB (virtual 4.411 GB)
docker容器大小:
root@uwsgi:/home/web/django_project# df -h
Filesystem Size Used Avail Use% Mounted on
none 73G 73G 0 100% /
tmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/disk/by-uuid/d02bdc6c-2230-40ce-8407-079095f72488 73G 73G 0 100% /var/log
41.74.147.98:/lustre/lfs01/EOSHARE/Karabo/CATALOGUE/thumbnails_cat3 151T 134T 9.8T 94% /home/web/django_project/thumbs_out
shm 64M 0 64M 0% /dev/shm
在容器内:
docker ps -s
我正在寻找有关docker容器最大大小的答案,我也试图制作一个卷(docker volume),然后将目录挂载到该卷,结果相同。并非所有目录都可以安装。
我的问题是:
df -h
的输出显示GB周围的虚拟大小
但当我执行到容器然后151T 134T
输出T - >看到
输出高于trait DefaultArgs {
void setArgs(Map args, DefaultArgs defaultArgs) {
if (defaultArgs) {
setArgs(defaultArgs.toArgsMap())
}
setArgs(args)
}
void setArgs(Map args) {
MetaClass thisMetaClass = getMetaClass()
args.each { name, value ->
assert name instanceof String
MetaProperty metaProperty = thisMetaClass.getMetaProperty(name)
assert name && metaProperty != null
if (value != null) {
assert metaProperty.type.isAssignableFrom(value.class)
}
thisMetaClass.setProperty(this, name, value)
}
}
Map toArgsMap() {
def properties = getProperties()
properties.remove('class')
return properties
}
}
。感谢。