You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Developing and Deploying Custom Docker Containers on Portenta X8
631
+
### Working with Docker on Portenta X8
632
632
633
-
To customize the Portenta X8, you can develop and deploy Docker containers. Start by provisioning your device as described in the [**Portenta X8 with Arduino Cloud**](#portenta-x8-with-arduino-cloud) section.
633
+
To customize the Portenta X8, you can develop and deploy Docker containers. Start by ensuring Docker is correctly set up on your device. A quick way to test Docker functionality is by running the official `Hello World` container from [Docker Hub](https://hub.docker.com/).
634
634
635
-
Once ready, you can customize Portenta X8, for example, Thing and Dashboard. This can be done by writing your own Python script leveraging the [Arduino IoT Cloud Python library](https://github.com/arduino/arduino-iot-cloud-py). Check the documentation and the examples inside the library to learn more about creating your own Python application.
636
-
637
-
When your Python script is ready, you have to create a dedicated Dockerfile to integrate your new script. The Dockerfile needs the Arduino Linux Wizard Python container (i.e., `arduino-ootb-python-devel`) to interact with your Arduino Cloud account correctly.
638
-
639
-
So, open a terminal window and create a Dockerfile integrating the following code with your Python script:
635
+
First, pull the image using the following command:
640
636
641
637
```bash
642
-
FROM arduino/arduino-ootb-python-devel:latest
638
+
docker pull hello-world
643
639
```
644
640
645
-
```bash
646
-
# Copy custom python cloud scripts
647
-
COPY ./custom-examples /root/custom-examples
648
-
```
641
+
Then, run the container:
649
642
650
643
```bash
651
-
RUN chmod -R 755 /root/custom-examples
644
+
docker run hello-world
652
645
```
653
646
647
+
This simple process pulls and runs the `Hello World` container, verifying that Docker is available and functional on your Portenta X8. The following clip shows running the `Hello World` container briefly:
648
+
649
+

650
+
651
+
With this, you can start customizing the Portenta X8 by creating and deploying containers tailored to your needs. For example, you can develop Python applications or other utilities and package them into Docker containers for deployment.
652
+
653
+
***You can explore [__Arduino's Docker Hub__](https://hub.docker.com/u/arduino) for a repository of preconfigured Docker images designed to simplify development on the Portenta X8.***
654
+
654
655
#### Build Your Container
655
656
656
-
You can create your custom containers and build them inside the Portenta X8. Since Portenta X8 is based on an arm64 architecture, you can use the command `build` only if you build the container directly on an arm64 architecture (e.g., Macbook based on M1/M2 processor or Portenta X8). Open a terminal window and type:
657
+
You can create your custom containers and build them inside the Portenta X8. Since Portenta X8 is based on an *arm64 architecture*, you can use the command `build` only if you build the container directly on an *arm64 architecture* (e.g., Macbook based on M1/M2 processor or Portenta X8). Open a terminal window and type:
657
658
658
659
```bash
659
660
docker build . -t x8-custom-devel
@@ -671,7 +672,7 @@ It is time for you to deploy the newly created Docker image. To do so, save it s
671
672
672
673
#### Managing Early Start Services When Building Custom Containers
673
674
674
-
The Portenta X8 firmware includes **`compose-apps-early-start.service`**, which starts certain Docker Compose applications early during the boot process. This feature helps pre-configured services run smoothly but may sometimes interfere with custom containers you pull or build.
675
+
The Portenta X8 firmware includes the **`compose-apps-early-start.service`**, which starts certain Docker Compose applications early during the boot process. This feature helps pre-configured services run smoothly but may sometimes interfere with custom containers you pull or build.
675
676
676
677
For example, system tools like [**Skopeo**](https://www.redhat.com/en/topics/containers/what-is-skopeo) may automatically remove containers without warning. This can happen to containers pulled from external sources or locally built on the device. If you notice that your custom containers are being removed unexpectedly, you can solve this by managing the system services with a few command lines.
Stopping and disabling these services will prevent the early start of compose applications, ensuring your custom containers are not removed automatically. Additionally, make sure to check for the [*latest firmware image*](https://downloads.arduino.cc/portentax8image/image-latest.tar.gz) to maintain compatibility and optimal performance of the Portenta X8 with custom container developments.
694
695
695
-
696
696
#### Deploy Your Container With Docker Hub
697
697
698
698
If you have a [Docker Hub account](https://hub.docker.com/), you can freely upload your Docker image to your registry (e.g., `yourhubusername`):
@@ -780,7 +780,7 @@ services:
780
780
It is now time to upload the new `docker-compose.yml` to your Portenta X8:
781
781
782
782
```bash
783
-
docker-compose up --detach
783
+
dockercompose up --detach
784
784
```
785
785
786
786
And you are ready to go! Your Portenta X8 Dashboards and Things can be customized using the same process multiple times.
0 commit comments