Android root-free kernel-free compilation and running container & udocker basic tutorial [nethunter] [termux] [docker alternative] [udocker]

【Last update: 2023.4.15

Please do not use the relevant technologies in the article to engage in illegal testing. Any direct or indirect consequences and losses caused by the dissemination and use of the information provided in this article shall be borne by the user himself, and the author shall not bear any responsibility for this~

"The following operations do not need to use docker as a dependency implementation"

Article directory

1 Introduction

2. Introduction

3. Install

0 latest additions

3.1 Installation dependencies

3.2 Install udocker

4. use

4.1Syntax

4.2 Usage case (here I take the busybox container as an example)

4.3 Delete Container/Extracted Container

4.4 More Advanced Uses

5. Wish everyone a happy Chinese New Year :)

6. Reference

[Reprint please indicate the source and original author]


1. Preface

This is the first article I wrote, and it is also the only complete udocker installation tutorial in China, how to use it and go around the pit. If there are some places that are not well written, I hope everyone in the community will be considerate~ The following is Let me introduce Udocker to you by Tangyuan....

2. Introduction

Udocker : A basic user tool that can execute simple docker containers in batch or interactive systems without root privileges and docker has the characteristics of less dependencies, local files, and no root

3. Install

0 latest additions

Forgot to tell everyone, if you execute udocker directly under root, there will be a prompt asking not to run as root

Solution: Add "--allow-root" after the command "udocker"

Such as: udocker --allow-root install

3.1 Installation dependencies

-python3/python2
-pycurl/curl
-hashlib/openssl
-tar
-find
-chmod
-chgrp
-ldconfig

3.2 Install udocker

Installation plan one (recommended)

wget https://github.com/indigo-dc/udocker/releases/download/1.3.6/udocker-1.3.6.tar.gz
tar zxvf udocker-1.3.6.tar.gz
export PATH=`pwd`/udocker-1.3.6/udocker:$PATH
udocker install
Other solutions: See https://indigo-dc.github.io/udocker/installation_manual.html 
Pit: Some strange errors occur when running udocker install 
Pitfall solution: 
Install tarballs files
curl -L https://github.com/jorge-lip/udocker-builds/raw/master/tarballs/udocker-englib-1.2.8.tar.gz > udocker-englib-1.2.8.tar.gz
Set the tarballs file path and perform a reinstall
export UDOCKER_TARBALL=udocker-englib-1.2.8.tar.gz
udocker install --force

4. use

Forgot to tell everyone, if you execute udocker directly under root, there will be a prompt asking not to run as root

Solution: after the command "udocker"

4.1Syntax

        Commands:
          search <repo/expression>      :搜索dockerhub以获取容器图像
          pull <repo/image:tag>         :从dockerhub拉取容器映像
          create <repo/image:tag>       :从拉取的图像创建容器
          run <container>               :执行容器

          images -l                     :列出容器图像
          ps -m -s                      :列出创建的容器
          name <container_id> <name>    :为容器命名
          rmname <name>                 :从容器中删除名称
          rename <name> <new_name>      :更改容器名称
          clone <container_id>          :克隆容器
          rm <container-id>             :删除容器
          rmi <repo/image:tag>          :删除图像

          import <tar> <repo/image:tag> :导入tar文件(由docker导出)
          import - <repo/image:tag>     :从stdin进口(由docker出口)
          export -o <tar> <container>   :导出容器目录树
          export - <container>          :导出容器目录树
          load -i <imagefile>           :从文件中加载图像(由docker保存)
          load                          :从stdin加载图像(由docker保存)
          save -o <imagefile> <repo/image:tag>  :将带有图层的图像保存到文件中

          inspect -p <repo/image:tag>   :返回图像上的低级信息
          verify <repo/image:tag>       :验证拉取或加载的图像

          protect <repo/image:tag>      :保护存储库
          unprotect <repo/image:tag>    :取消存储库保护
          protect <container>           :保护容器
          unprotect <container>         :取消储存库保护

          mkrepo <top-repo-dir>         :在位置创建另一个存储库
          setup                         :更改容器执行设置
          login                         :登录docker存储库
          logout                        :从docker存储库注销

          help                          :This help
          run --help                    :特定于命令的帮助
          version                       :显示udocker版本

        Options common to all commands must appear before the command:
          -D                            :Debug
          --quiet                       :更少的冗差
          --repo=<directory>            :在目录中使用存储库
          --insecure                    :允许不安全的未经身份验证https
          --allow-root

​​​​

4.2 Usage case (here I take the busybox container as an example)

在dockerhub中搜索容器图像:udocker search busybox
从dockerhub中拉取容器图像:udocker pull arm64v8/busybox(这边汤圆为安卓设备对应架构arm64v8)
(提取容器:udocker create arm64v8/busybox)
提取并运行容器:udocker run arm64v8/busybox

Tip : An error message appears when running the udocker container, indicating that the container architecture may be different from the native architecture (the error is reported as shown in the figure below)cae4ae70059946c288226ea9d4e18864.png

Finally, attach a picture of udocker successfully running busybox

1cad3b1a9996414880e284a1340f8648.png

Tip : Pay attention to the displayed "garbled characters" (below)19805e612d674e27bbb0543765ad4266.png

If you need to use the container again, you can run udocker run "garbled"

Or you can run udocker ps to list the "garbage" of the extracted container

If you run udocker run arm64v8/busybox will re-extract the container and run

4.3 Delete Container/Extracted Container

udocker rmi 容器名称
udocker rm 已提取的容器“乱码”

4.4 More Advanced Uses

Open source project https://github.com/indigo-dc/udocker
Manual https://indigo-dc.github.io/udocker

5. Reference

https://www.5axxw.c+om/wiki/content/7r7m6n

https://indigo-dc.github.io/udocker/

If there is any infringement of the content of the article, please contact me~

[iOS whole life plan: >Look at me< ​​​​​​​​]

[Reprint please indicate the source and original author]

Guess you like

Origin blog.csdn.net/qq_57851190/article/details/128757438