This knowledge base article will describe how to create a docker image and docker container within Ubuntu 22.04 that can run LUCID’s Arena SDK.
Install Docker Engine on Ubuntu
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
Set up the repository:
- Update the
apt
package index and install packages to allowapt
to use a repository over HTTPS:
$ sudo apt-get update
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
- Add Docker’s official GPG key:
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- Use the following command to set up the repository:
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine:
- Update the
apt
package index:
$ sudo apt-get update
Install Docker Engine, containerd, and Docker Compose.
- To install the latest version, run:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
- Verify that the Docker Engine installation is successful by running the
hello-world
image:
$ sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
You have now successfully installed and started Docker Engine. The docker
user group exists but contains no users, which is why you’re required to use sudo
to run Docker commands. Continue to Linux post-install to allow non-privileged users to run Docker commands and for other optional configuration steps.
Get the Dockerfile, Install Docker image and run the Docker Container:
Head to GitHub – lucidvisionlabs/arena_camera_ros2: Arena Camera driver for ROS2 and download as a zip file.
Download ArenaSDK and Python_API from Downloads
Extract the ROS2 zip file to the desired installation location.
Here is the directory structure:
arena_camera_ros2-master
── docker-compose.yml
├── Dockerfile << This should be the dockerfile from the Github repo
├── README.md
├── resources
│ ├── arena_api << copy <arena_api-2.3.3-py3-none-any.whl> under this directory
│ └── ArenaSDK << copy <ArenaSDK_v0.1.68_Linux_x64.tar.gz> under /ArenaSDK/linux64/
├── ros2_arena_setup.sh
├── ros2_ws
│ ├── arena_api-2.0.0-py3-none-any.whl
│ ├── build
│ ├── install
│ ├── log
│ ├── ros2_ws_and_software.code-workspace
│ ├── src
│ └── usefull_cmnds.txt
└── _VERSION_PY_
After copying the SDK and .whl file to the directory folders open up the terminal:
$ cd back to arena_camera_ros2-master/
$ sudo docker build -f Dockerfile -t osrf/ros:eloquent-desktop-lucid-camera-v.1.0 .
$ sudo docker images
Next, list all the docker images built –
$ sudo docker run -it --network host osrf/ros:eloquent-desktop-lucid-camera-v.1.0 .
The docker container will open.
Head to the compiled examples folder in ArenaSDK_Linux_x64 and run Cpp_Acquisition.cpp
Optionally, we can create a MACVLAN network which assigns a MAC address to the docker container and bridges it to the physical network on the host system.
To create a MacVLan network:
$ sudo docker network create -d macvlan --subnet 169.254.0.0/16 --gateway 169.254.0.1 --ip-range 169.254.0.253/32 -o parent=enp2s0 custommacvlan