0

Is it possible, and if so what is the correct syntax for passing the host i2c port, or some other peripheral to the container, via definition in the dockerfile?

Here is a basic dockerfile -

#Deriving the latest base image
FROM python:latest


#Labels as key value pair
LABEL Maintainer="nice try"


# Any working directory can be chosen as per choice like '/' or '/home' etc
WORKDIR /usr/app/src

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt



#to COPY the remote file at working directory in container
COPY main.py ./
# Now the structure looks like this '/usr/app/src/test.py'


#CMD instruction should be used to run the software
#contained by your image, along with any arguments.

CMD [ "python", "./main.py"]

I'm aware that i can do it from the command line when running the container, but this doesn't seem like a neat solution.

Thanks!

Ben Bird
  • 374
  • 1
  • 5
  • 16
  • Does this answer your question? https://stackoverflow.com/questions/40265984/i2c-inside-a-docker-container – Nick ODell Apr 15 '23 at 02:50
  • (Especially see its accepted answer; "you can't".) – David Maze Apr 15 '23 at 11:04
  • Yes i'd seen that, but that gives the following error - ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 16: unknown instruction: DEVICES: – Ben Bird Apr 15 '23 at 18:34

0 Answers0