16

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), 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

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

you are viewing a single comment's thread
view the rest of the comments
[-] setenforce@sh.itjust.works 2 points 6 months ago

I would take a look at https://stackoverflow.com/questions/48691782/putting-files-in-a-docker-image

Probably way easier to bake the file directly into the image

[-] Valmond@lemmy.mindoki.com 1 points 6 months ago
[-] setenforce@sh.itjust.works 2 points 6 months ago
[-] Valmond@lemmy.mindoki.com 1 points 6 months ago

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 ๐Ÿ˜Š.

this post was submitted on 17 Apr 2024
16 points (86.4% liked)

Asklemmy

43822 readers
923 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS