Docker Volume Mounting: How to find path in container?

  docker, docker-compose, docker-volume

I have a python script that I have placed inside a docker container named "grapher". The python script inside the "grapher" container generates a graph and saves it like so:

# CODE ABOVE THIS MAKES PLOT #
plt.draw()
filename = "digraph" + str(self.count) + ".png"
plt.savefig(filename)

I want to access these saved figures on my computer, so I am attempting to use "volumes" inside my docker-compose file. The problem is, all the tutorials I find say I need to include the "path in the container". And then the tutorials just magically know what file path to use.

How the heck do I figure out what filepath my container is using?? I’ve made a bunch of file location guesses based off the tutorials I’ve found, one of which caused Ubuntu 18.04 to black-screen-of-death (whoops…). I am totally lost. I’ve included a snippet of my docker-compose.yml file below.

version: '3.0'
services:
  # OTHER CONTAINERS ABOVE THIS#
  grapher:
     build: ./Grapher
     depends_on:
       - hmi_pass_thru
     volumes:
      - graph-data:/home/vic/Documents/5ExtraExtraNodes/Grapher
     network_mode: host

volumes:
  graph-data:
networks:
  test_net:
    external: true

Please help.

Source: Docker Questions

LEAVE A COMMENT