Hello all!

Can you mount any folder a docker image is running in?

So for example, if I have a python script creating a file “./hello.txt”, it would be written in the folder where I launch “docker-compose up” ?

I have figured out how to write the hello.txt to a subfolder like /data/ (by mapping an image-local folder to /data/), but I’d like to use like ./ for the image itself instead. So that the folder I’m launching the docker-compose in on my PC is mapped to ./ in the image, if that makes more sense.

So this works (in the compose.yml):

volumes:

  - ./:/data

but the script must write to “./data/hello.txt”

This doesn’t work:

volumes:

  - ./:./

It pops an error: mount path must be absolute

Any idea if this is even possible?

Cheers and thanks !

  • @Fal
    link
    fedilink
    English
    13 months ago

    I have my executables in a “binaries_to_use” folder, is there any way to add them to this local work folder? I tried the thing that worked before:

    Put them in one of the folders on the $PATH or provide an absolute path to them in your CMD