Hello,
Thanks for the response it was helpful.
I’m sorry for the misunderstanding.
I used the task runner to push realase arm64. If I understood correctly, put the image and the production container on my SOM.
the container works as it should, it runs an OPC UA server which works when I test it.
Now I would like to create my production image with “create production image” (the rest of the guide) in order to put my image in the docker hub to be able to pull it onto all my SoM.
I used “create-production-images” in the task runner and it worked.
I used docker desktop to push the created image to the docker hub.
I can pull it without problem on my “test” SoM and run it.
The problem is that the container does not seem to have the rights to access for example the SPI or PWM whereas with the image generated in the previous step, I did not have this problem.
Here is my modified Dockerfile:
# ARGUMENTS --------------------------------------------------------------------
##
# Board architecture
##
ARG IMAGE_ARCH=
# For armv7 use:
#ARG IMAGE_ARCH=arm
##
# Base container version
##
ARG BASE_VERSION=3.0.8-bookworm
ARG APP_ROOT=
FROM --platform=linux/${IMAGE_ARCH} \
torizon/debian:${BASE_VERSION} AS Deploy
ARG IMAGE_ARCH
ARG APP_EXECUTABLE
ARG APP_ROOT
# your regular RUN statements here
# Install required packages
RUN apt-get -q -y update && \
apt-get -q -y install \
python3-minimal \
python3-pip \
python3-venv \
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
# __torizon_packages_prod_start__
libgpiod-dev:arm64 \
gpiod:arm64 \
# __torizon_packages_prod_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
&& apt-get clean && apt-get autoremove && \
rm -rf /var/lib/apt/lists/*
# Allow the user torizon use GPIOs and SPI
RUN usermod -a -G gpio root
# Allow user "root" to use PWM
RUN usermod -a -G pwm root
RUN usermod -a -G spidev root
# Create virtualenv
RUN python3 -m venv ${APP_ROOT}/.venv --system-site-packages
RUN apt-get update && apt-get install -y build-essential python3-dev
# Install pip packages on venv
COPY requirements-release.txt /requirements-release.txt
RUN . ${APP_ROOT}/.venv/bin/activate && \
pip3 install --upgrade pip && pip3 install --break-system-packages -r requirements-release.txt && \
pip3 install spidev && \
rm requirements-release.txt
RUN apt-get -q -y install \
python3-libgpiod
# copy the source code
COPY /src ${APP_ROOT}/src
WORKDIR ${APP_ROOT}
ENV APP_ROOT=${APP_ROOT}
# Activate and run the code
CMD . ${APP_ROOT}/.venv/bin/activate && python3 src/main.py --no-sandbox
As well as my docker-compose.yml also modified:
version: "3.9"
services:
quickstart-debug:
privileged: true
build:
context: .
dockerfile: Dockerfile.debug
image: ${LOCAL_REGISTRY}:5002/quickstart-debug:${TAG}
ports:
- 6502:6502
- 6512:6512
quickstart:
privileged: true
build:
context: .
dockerfile: Dockerfile
image: ${DOCKER_LOGIN}/quickstart:${TAG}
ports:
- 6502:6502
- 6512:6512
- 4840:4840
volumes:
- type: bind
source: /dev
target: /dev
read_only: false
- type: bind
source: /sys
target: /sys
read_only: false
# Add device access rights through cgroup...
device_cgroup_rules:
- "c 254:* rmw"
- "c 248:* rmw"
devices:
- "/dev/spidev1.0"
Does i miss something in the configuration ? I used “autolab23” as namespace and “v1.0” as tag for the “create production image”
here is the error i get:
torizon@verdin-imx8mm-xxx:~$ docker run autolab23/quickstart:v1.0
cryptography is not installed, use of crypto disabled
cryptography is not installed, use of crypto disabled
Traceback (most recent call last):
File "//src/main.py", line 27, in <module>
spi.open(1, 0) # bus, device 200 000 /dev/spidev1.0
^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory