{"id":653,"date":"2024-03-08T08:00:12","date_gmt":"2024-03-08T00:00:12","guid":{"rendered":"https:\/\/www.zhoubin.asia\/?p=653"},"modified":"2024-03-25T17:56:50","modified_gmt":"2024-03-25T09:56:50","slug":"docker","status":"publish","type":"post","link":"https:\/\/www.zhoubin.asia\/index.php\/2024\/03\/08\/docker\/","title":{"rendered":"\u5982\u4f55\u4ece0\u5f00\u59cb\u4f7f\u7528Docker \u5b9e\u73b0 Ubuntu \u7cfb\u7edf\u4e0b\u7684 Hailo Tappas Demo \u5c55\u793a"},"content":{"rendered":"<h3>\u4f7f\u7528\u547d\u4ee4\u62c9\u4e00\u4e2a\u6807\u51c6\u7684 22.04 \u7684 Docker\uff1a<\/h3>\n<pre><code>docker pull ubuntu:22.04<\/code><\/pre>\n<h3>\u6211\u4eec\u53ef\u4ee5\u5c06\u8fd9\u4e2a Docker \u7684 image \u4fdd\u5b58\u6210 har \u6863\uff08\u53c2\u8003 Tappas \u811a\u672c\u7684 har \u683c\u5f0f\uff09<\/h3>\n<p>\u8003\u8651\u5230\u6211\u4eec\u8fd0\u884c\u811a\u672c\u7684\u56e0\u7d20\uff0c\u6211\u4eec\u5c06\u8fd9\u4e2a image \u91cd\u65b0\u505a tag<\/p>\n<pre><code>docker tag [image id] hailo_tappas:v3.27.0<\/code><\/pre>\n<pre><code>docker save -o hailo-docker-tappas-v3.27.0.tar hailo_tappas:v3.27.0<\/code><\/pre>\n<p>\u8fd9\u6837\u6211\u4eec\u5c31\u5f97\u5230\u4e86\u4e00\u4e2a\u6709 tag: hailo_tappas:v3.27.0 \u7684\u5b9e\u9645 Ubuntu 22.04 \u57fa\u7840 Docker image\u3002<\/p>\n<h3>\u6211\u4eec\u4f7f\u7528 Hailo \u5b98\u7f51\u4e0b\u8f7d\u7684 Tappas Docker \u811a\u672c run_tappas_docker.sh \u5bfc\u5165\u8fd9\u4e2a image<\/h3>\n<pre><code>run_tappas_docker.sh --tappas-image hailo-docker-tappas-v3.27.0.tar<\/code><\/pre>\n<p>\u4e3a\u4ec0\u4e48\u4f7f\u7528\u8fd9\u4e2a\u811a\u672c\uff0c\u4e3b\u8981\u6709\u4e24\u70b9\u539f\u56e0\uff1a<\/p>\n<ol>\n<li>\u56e0\u4e3a\u8fd9\u4e2a\u811a\u672c\u4f1a\u901a\u8fc7 Docker \u4f7f\u7528 host \u7684\u786c\u4ef6\u8bbe\u5907\uff08Hailo \u8bbe\u5907\u4ee5\u53ca Hailo \u9a71\u52a8\uff09<\/li>\n<li>\u8fd9\u4e2a\u811a\u672c\u4f1a\u4f7f\u7528 host \u7684\u663e\u793a\u754c\u9762\uff0c\u4ece\u800c\u5728 Docker \u4e2d\u8fd0\u884c\u7684\u663e\u793a\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u5728 host \u4e0a\u6b63\u5e38\u663e\u793a\uff08\u6240\u4ee5\u8fd0\u884c\u811a\u672c\u7684\u65f6\u5019\u4e0d\u8981\u4f7f\u7528 SSH\uff0c\u76f4\u63a5\u5728\u4e3b\u63a7\u4e2d\u901a\u8fc7 terminal \u8fd0\u884c\uff09<\/li>\n<\/ol>\n<h3>\u5bfc\u5165\u4ee5\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528 run_tappas_docker.sh &#8211;resume \u5bf9\u5e94\u7684 container \u53bb\u5b89\u88c5\u5fc5\u987b\u5b89\u88c5\u7684\u5305\uff0c\u4ece\u800c\u5b89\u88c5\u597d Tappas<\/h3>\n<p>\u5b89\u88c5\u4e4b\u524d\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u52a0\u5165\u5176\u4ed6 apt \u6e90\uff1a<\/p>\n<pre><code>sed -i 's\/archive.ubuntu.com\/mirrors.aliyun.com\/g' \/etc\/apt\/sources.list<\/code><\/pre>\n<p>\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528<\/p>\n<pre><code>dpkg -i hailort_4.16.0_amd64.deb<\/code><\/pre>\n<p>\u5177\u4f53 Tappas \u5b89\u88c5\u53ef\u4ee5\u53c2\u8003\uff1a<a href=\"https:\/\/github.com\/giladnahor\/hailo_rpi5_examples\/blob\/main\/doc\/install-raspberry-pi5.md\">https:\/\/github.com\/giladnahor\/hailo_rpi5_examples\/blob\/main\/doc\/install-raspberry-pi5.md<\/a><\/p>\n<h3>\u9644: \u7a0d\u5fae\u89e3\u91ca\u4e0b\u6211\u7406\u89e3\u4e2d\u7684 run_tappas_docker.sh \u4e2d\u5b9e\u73b0\u5171\u4eab host \u7aef\u786c\u4ef6\u8bbe\u5907\u4ee5\u53ca host \u7aef\u663e\u793a\u7684\u529f\u80fd<\/h3>\n<pre><code>function prepare_docker_args() {\r\n    DOCKER_ARGS=\"--privileged --net=host \\\r\n        --name \"$CONTAINER_NAME\" \\\r\n        --ipc=host \\\r\n        --device \/dev\/dri:\/dev\/dri \\\r\n        -v ${XAUTH_FILE_PC}:${XAUTH_FILE_CONTAINER} \\\r\n        -v \/tmp\/.X11-unix\/:\/tmp\/.X11-unix\/ \\\r\n        -v \/dev:\/dev \\\r\n        -v \/lib\/firmware:\/lib\/firmware \\\r\n        --group-add 44 \\\r\n        -e DISPLAY=$DISPLAY \\\r\n        -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \\\r\n        -e hailort_enable_service=yes \\\r\n        -v $(pwd)\/${SHARED_DIR}\/:\/local\/${SHARED_DIR}:rw\"\r\n}\r\ndocker run $DOCKER_ARGS -it $IMAGE_NAME:$CONTAINER_TAG\r\n<\/code><\/pre>\n<p>\u7136\u540e\u5728\u4ee5\u540e\u8fd0\u884c container \u7684\u65f6\u5019\uff0c\u91c7\u7528\u4e00\u4e9b host \u7aef\u7684\u4e34\u65f6\u6587\u4ef6\u6765\u4fdd\u5b58 DISPLAY \u7684\u53c2\u6570\uff0c\u4ece\u800c\u8fbe\u5230\u652f\u6301 host \u7aef\u663e\u793a<\/p>\n<pre><code>function handle_xauth() {\r\n    # The function extracts auth entry for current display and saves it to specified file.\r\n    # It's a workaround for ub22 random name of xauth file, which changes every reboot.\r\n    touch $XAUTH_FILE_PC\r\n    xauth nlist $DISPLAY | sed -e 's\/^....\/ffff\/' | xauth -f $XAUTH_FILE_PC nmerge -\r\n    chmod o+rw $XAUTH_FILE_PC\r\n}\r\ndocker start \"$CONTAINER_NAME\"\r\ndocker exec -it -e DISPLAY=$DISPLAY \"$CONTAINER_NAME\" \/bin\/bash\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u547d\u4ee4\u62c9\u4e00\u4e2a\u6807\u51c6\u7684 22.04 \u7684 Docker\uff1a docker pull ubuntu:22.04 \u6211\u4eec\u53ef [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[1,12],"tags":[],"class_list":["post-653","post","type-post","status-publish","format-standard","hentry","category-tech","category-others"],"_links":{"self":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/comments?post=653"}],"version-history":[{"count":1,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/653\/revisions"}],"predecessor-version":[{"id":654,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/posts\/653\/revisions\/654"}],"wp:attachment":[{"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/media?parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/categories?post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhoubin.asia\/index.php\/wp-json\/wp\/v2\/tags?post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}