Running docker image in specific folder (again, now with run)

https://lemmy.mindoki.com/post/658695

Running docker image in specific folder (again, now with run) - Mindoki

Hello all ! I have a docker image that you can run with: docker compose -f compose_10f.yml up The compose_10f.yml looks like this: services: setup: image: tenfingers_10f:v1 volumes: - ./:/data working_dir: /data/ Which makes the image believe it runs in ./ so if it saves “./hello” it will be saved in the folder where it’s launched (it works). The thing is, it’s a command line program (named 10f.py [http://10f.py]), not a server or such, so I’d like to run it like this: docker run -v ./:/data -w /data/ tenfingers_10f:v1 10f.py [http://10f.py] And it works with the exception it doesn’t get to run in the mounted ./ folder. It confuses the “mount” (or I’m just lucky the compose file works?) and it believes it lives in /data/, not in ./ python3: can't open file '/data/10f.py': [Errno 2] No such file or directory I did struggle to set this up in the compose file, but I’d like to make the images run in a specific directory thinking they are in ./ Any ideas how I can figure this out? Cheers and thank you so much! Valmond

I would take a look at stackoverflow.com/…/putting-files-in-a-docker-ima…

Probably way easier to bake the file directly into the image

Putting files in a Docker image

I am creating a Docker image from a Dockerfile. It installs an application when pulled and the Dockerfile is the following: #Base image FROM centos:latest #Update image RUN yum install -y git \ ...

Stack Overflow
Interesting! Will check out.
Let me know how it goes!
I think I must let the scripts run in a subfolder, I have started to understand the mounting of a folder into the already existing docker file system and well I guess I just have to bite the bullet 😊.