我在很多地方看到人们创建了一个用于存储的sidekick容器,然后使用volumes-from
选项来安装此存储。
实施例
es-master:
image: foo
labels:
io.rancher.sidekicks: es-storage
volumes_from:
- es-storage
es-storage:
labels:
io.rancher.container.start_once: true
network_mode: none
image: rawmind/alpine-volume:0.0.2-1
environment:
- SERVICE_UID=1000
- SERVICE_GID=1000
- SERVICE_VOLUME=/usr/share/elasticsearch/data
volumes:
- es-storage-volume:/usr/share/elasticsearch/data
volumes:
es-storage-volume:
driver: ${VOLUME_DRIVER}
per_container: true