I am trying to inset data files from different images to the named volume so that I can use it in another service for creating database along with seed data. In the below scenario I can see the
data-db1 folder created but not
data-db2 when I do the compose up. Is this the right way to do or am I missing something here?
The requirement is to have one directory which contains all the different db folders with respective scripts.
Since I can’t mount image as read only volume, I am focusing on this approach.
Appreciate the help if there is a better pattern to this issue.
version:` "3.9" services: data-db1: image: data-db1 build: context: ./multiple-db dockerfile: data-db1.Dockerfile container_name: data-db1 volumes: - type: volume source: data target: /data command: /usr/bin/tail -f /dev/null data-db2: image: data-db2 build: context: ./multiple-db dockerfile: data-db2.Dockerfile container_name: data-db2 volumes: - type: volume source: data target: /data command: /usr/bin/tail -f /dev/null depends_on: - data-db1 volumes: data:
FROM alpine AS base WORKDIR /data COPY ./data-db1 /data/data-db1
FROM alpine AS base WORKDIR /data COPY ./data-db2 /data/data-db2