Container Deployment
- Install Docker on the server.
yum install docker
- Prepare a CA and a TA.You can develop your own CA and TA by following instructions in Setting Up the TA and CA Development Environment. This demo uses helloworld provided in iTrustee SDK as an example.
- To obtain the source code, download itrustee_sdk and libboundscheck from the Gitee official website and move libboundscheck to thirdparty/open_source/.
git clone https://gitee.com/openeuler/itrustee_sdk.git git clone https://gitee.com/openeuler/libboundscheck.git mv libboundscheck itrustee_sdk/thirdparty/open_source/
- Prepare TA compilation resources.
Obtain the config and private_key.pem files by following instructions in Applying for a TA Developer Certificate in a Debugging Environment and move the two files to signed_config/ and TA_cert/, respectively.
cd itrutee_sdk/build/signtools/ mkdir signed_config mkdir TA_cert cp /path/to/config ./signed_config/ cp /path/to/private_key.pem ./TA_cert/
- Compile the CA of the helloworld demo.
- Open ca_demo.c.
cd ../../test/CA/helloworld/ vim ca_demo.c
- Press i to enter the insert mode. Modify the UUID of the TA and add the TA path.


- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Generate the demo_hello application (CA).
make
- Open ca_demo.c.
- Compile the TA of the helloworld demo.
- Open manifest.txt.
cd ../../TA/helloworld/ vim manifest.txt
- Press i to enter the insert mode. Modify the corresponding variables in manifest.txt based on the content of the configs.xml file used to apply for the config file.

- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Generate the < UUID >.sec file (for the TA).
make
- Open manifest.txt.
- To obtain the source code, download itrustee_sdk and libboundscheck from the Gitee official website and move libboundscheck to thirdparty/open_source/.
- Download an openEuler image and import it.
wget https://mirrors.huaweicloud.com/openeuler/openEuler-22.03-LTS-SP1/docker_img/aarch64/openEuler-docker.aarch64.tar.xz docker load -i openEuler-docker.aarch64.tar.xz

- Copy the CA and TA and the dependency files to a directory for building images.
mkdir build && cd build cp ../itrustee_sdk/test/CA/helloworld/demo_hello ./ cp ../itrustee_sdk/test/TA/helloworld/*.sec ./ cp /usr/lib64/libboundscheck.so ./ cp /usr/lib64/libteec.so ./ cp /usr/bin/tlogcat ./ cp /usr/bin/agentd ./
The image build directory contains the following files:

- You can run the ldd command to view the dependency files. For example, to view the dependency files of agentd:
ldd agentd

The basic image of openEuler contains all the SO libraries except libboundscheck.so and libteec.so. Therefore, in this example, only the two SO libraries are copied to the image. For other OS images, copy all the missing libraries.
- The version of the REE patch copied to the container must be the same as that on the host. Otherwise, the TEE OS in the container is unavailable.
- You can run the ldd command to view the dependency files. For example, to view the dependency files of agentd:
- Create a Dockerfile.
- Create a file.
vim Dockerfile
- Press i to enter the insert mode and add the following content:
FROM openeuler-22.03-lts-sp1 RUN mkdir -p /vendor/bin && mkdir -p /data COPY *.so /usr/lib64/ COPY tlogcat agentd /usr/bin/ COPY *.sec /data/ COPY demo_hello /vendor/bin/ RUN chmod +x /vendor/bin/demo_hello CMD /usr/bin/agentd & /vendor/bin/demo_hello
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Create a file.
- Run the following command to build the image:
docker build -t demo_hello .

- Start the container based on the image and obtain the run logs of the container.
docker run -it --mount type=bind,source=/var/itrustee/teecd,target=/var/itrustee/teecd,readonly --device /dev/teelog:/dev/teelog:wr --device /dev/tc_ns_cvm:/dev/tc_ns_cvm:wr -d demo_hello docker logs -f <container_id>

- If the container requires TA2TA, trusted storage, or a high-level language, start agentd in the container before executing the CA.
- To enable support for high-level languages in a container, copy the tee_teleport tool to the container. The methods of using tee_teleport in a container are the same as those of deploying and running high-level languages on the host.