Appendix – Building SNAP Container with Custom SPDK
The SNAP source package contains the files necessary for building a container with a custom SPDK.
To build the container:
- Download and install the SNAP sources package: - [dpu] # dpkg -i /path/snap-sources_<version>_arm64.deb 
- Navigate to the src folder and use it as the development environment: - [dpu] # cd /opt/nvidia/nvda_snap/src 
- Copy the following to the container folder: - SNAP source package – required for installing SNAP inside the container 
- Custom SPDK – to container/spdk. For example: - [dpu] # cp /path/snap-sources_<version>_arm64.deb container/ [dpu] # git clone -b v23.01.1 --single-branch --depth 1 --recursive --shallow-submodules https://github.com/spdk/spdk.git container/spdk 
 
- Modify the spdk.sh file if necessary as it is used to compile SDPK. 
- To build the container: - For Ubuntu, run: - [dpu] # ./container/build_public.sh --snap-pkg-file=snap-sources_<version>_arm64.deb 
- For CentOS, run: - [dpu] # rpm -i snap-sources-<version>.el8.aarch64.rpm [dpu] # cd /opt/nvidia/nvda_snap/src/ [dpu] # cp /path/snap-sources_<version>_arm64.deb container/ [dpu] # git clone -b v23.01.1 --single-branch --depth 1 --recursive --shallow-submodules https://github.com/spdk/spdk.git container/spdk [dpu] # yum install docker-ce docker-ce-cli [dpu] # ./container/build_public.sh --snap-pkg-file=snap-sources_<version>_arm64.deb 
 
- Transfer the created image from the Docker tool to the crictl tool. Run: - [dpu] # docker save doca_snap:<version> doca_snap.tar [dpu] # ctr -n=k8s.io images import doca_snap.tar Note- To transfer the container image to other setups, refer to appendix "Appendix – Deploying Container on Setups Without Internet Connectivity". 
- To verify the image, run: - [DPU] # crictl images IMAGE TAG IMAGE ID SIZE docker.io/library/doca_snap <version> 79c503f0a2bd7 284MB 
- Edit the image filed in the container/doca_snap.yaml file. Run: - image: doca_snap:<version> 
- Use the YAML file to deploy the container. Run: - [dpu] # cp doca_snap.yaml /etc/kubelet.d/ Note- The "Container deployment preparation steps" are required.