Specify Location of Docker Images, Containers & Volumes for each docker-compose.yml?

On a Ubuntu 18.04.3 machine with a new drive attached and mounted at /mnt/elk, is it possible to configure a docker-compose.yml such that all image, containers and volumes related to this docker-compose.yml will be stored in /mnt/elk?

Currently everything appears to be stored on the first drive at/var/lib/docker/overlay, /var/lib/docker/containers and /var/lib/docker/volumes and this drive is almost full. So we want to move a docker-compose setup (file shown below) from the first drive to the new drive at /mnt/elk.

The other docker-compose setups can remain on the first drive. It is ok to have the same image stored on both drives if another docker-compose.yml on the first drive requires that same image.

Thank you!


docker-compose.yml for use in /mnt/elk

From https://github.com/deviantony/docker-elk/blob/master/docker-compose.yml

version: '3.2'

services:
  elasticsearch:
    build:
      context: elasticsearch/
      args:
        ELK_VERSION: $ELK_VERSION
    volumes:
      - type: bind
        source: ./elasticsearch/config/elasticsearch.yml
        target: /usr/share/elasticsearch/config/elasticsearch.yml
        read_only: true
      - type: volume
        source: elasticsearch
        target: /usr/share/elasticsearch/data
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      ELASTIC_PASSWORD: changeme
      # Use single node discovery in order to disable production mode and avoid bootstrap checks
      # see https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
      discovery.type: single-node
    networks:
      - elk

  logstash:
    build:
      context: logstash/
      args:
        ELK_VERSION: $ELK_VERSION
    volumes:
      - type: bind
        source: ./logstash/config/logstash.yml
        target: /usr/share/logstash/config/logstash.yml
        read_only: true
      - type: bind
        source: ./logstash/pipeline
        target: /usr/share/logstash/pipeline
        read_only: true
    ports:
      - "5000:5000"
      - "9600:9600"
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk
    depends_on:
      - elasticsearch

  kibana:
    build:
      context: kibana/
      args:
        ELK_VERSION: $ELK_VERSION
    volumes:
      - type: bind
        source: ./kibana/config/kibana.yml
        target: /usr/share/kibana/config/kibana.yml
        read_only: true
    ports:
      - "5601:5601"
    networks:
      - elk
    depends_on:
      - elasticsearch

networks:
  elk:
    driver: bridge

volumes:
  elasticsearch:

Source: StackOverflow