- 21, Oct 2024
- #1
При определении именованных томов в
, their names are prepended with their parent folder name. This causes a problem when scripts outside of docker compose have to interact with them. The question is, what is the best way to deal with this?DRIVER VOLUME NAME local flaskthymedata_grafana-data local flaskthymedata_influxdb-data local flaskthymedata_postgres-data local veleda_grafana-data local veleda_influxdb-data local veleda_jekyll-cache local veleda_jekyll-data local veleda_postgres-data local veledaio_grafana-data local veledaio_influxdb-data local veledaio_jekyll-cache local veledaio_jekyll-data local veledaio_postgres-data
Пример сценария может включать в себя следующее docker volume ls
:
parent_folder
Где docker run \
--name helper \
--volume="parent_folder_jekyll-data:/web" \
-it busybox \
true
docker cp jekyll/web/. helper:/web
docker rm helper
named volume is populated by the following bash script:
jekyll-data
В приведенном выше случае version: "3"
services:
nginx:
build: ./nginx
container_name: nginx
ports:
- "80:80"
volumes:
- jekyll-data:/usr/share/nginx/html:ro
networks:
backend:
volumes:
jekyll-data:
is the name of the parent folder. This means that moving the contents to a different folder would break the application. Is there a proper way to deal with this situation?
Сокращенный вывод docker-compose.yml
where unnamed volumes have been removed:
docker-compose.yml
#docker #docker-compose #volume