在没有根权限的批处理或交互系统中执行简单docker容器的基本用户工具

udocker的Python项目详细描述


构建状态

在这一点上,人们都会注意到这一点;在这一点上,人们都会注意到这一点;在这一点上,他们的地址是:2F6E533F30A1B36911523EE74E6993B459EC98F/6874747470733A32222222222222222F17267676774756275756275757573657272656F6E74656E74656E74656E746E742E632E632E636F6E62626262626256565656565656565656565656F62E62626262565656565656565656F626262F6262F62E6262565656565656565656565656" />

udocker是在用户中执行简单docker容器的基本用户工具。 不需要根权限的空间。启用下载和执行 Linux系统中非特权用户的Docker容器 Docker不可用。它可以用来拉和执行Docker Linux批处理系统和交互式集群中的容器 由其他实体管理,如网格基础设施或外部 管理批处理或交互式系统。

udocker不需要任何类型的特权,也不需要部署 系统管理员提供的服务。它可以下载和执行 完全由最终用户决定。

udocker是多个工具的包装器,用于模拟 Docker的功能包括提取图像和运行容器 功能极小。

它是如何工作的

udocker是一个用python编写的简单工具,它有一个最小的集合 可以在多种Linux中执行的 系统:

udocker不使用docker,也不需要它的存在。

udocker只需提供一个类似chroot的 提取容器上的环境。当前的实施 支持不同的方法来模拟chroot启用 在类chroot环境下不需要特权的容器。 udocker透明地支持几种方法来执行容器 使用工具和库,如:

  • 普罗特
  • fakechroot
  • 运行c
  • 奇点

优点

  • 提供类似Docker的命令行界面
  • 支持Docker命令的子集: 搜索、拉取、导入、导出、加载、创建和运行
  • 了解Docker容器元数据
  • 可由最终用户部署
  • 不需要安装特权
  • 不需要执行特权
  • 不需要编译,只需传输python脚本并运行
  • 封装多个执行方法
  • 包括已编译的跨系统工作所需的工具
  • 使用GPGPU和MPI应用程序进行测试
  • 在新的和旧的Linux发行版上运行,包括: centos 6、centos 7、ubuntu 14、ubuntu 16、ubunto 18、fedora等

安装

请参阅安装手册

语法

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory

示例

一些用法示例:

在DockerHub中搜索容器图像。

udocker search  fedora
udocker search  ubuntu
udocker search  indigodatacloud

从DockerHub中提取并列出提取的图像。

udocker pull  fedora:25
udocker pull  busybox
udocker pull  iscampos/openqcd
udocker images

从DockerHub以外的注册表中提取。

udocker pull --registry=https://registry.access.redhat.com  rhel7
udocker create --name=rh7 rhel7
udocker run rh7

从拉取的图像创建容器并运行它。

udocker create --name=myfed  fedora:25
udocker run  myfed  cat /etc/redhat-release

运行将host/home/u457装载到容器目录/home/cuser中。 注意,您可以"挂载"容器中的任何主机目录 不是真正的装载,但目录将在容器中可见。

udocker run -v /home/u457:/home/cuser -w /home/user myfed  /bin/bash
udocker run -v /var -v /proc -v /sys -v /tmp  myfed  /bin/bash

将脚本放入主机/tmp并在容器中执行。

udocker run  -v /tmp  myfed  /bin/bash -c 'cd /tmp; ./myscript.sh'

在同一容器中运行挂载主机/var、/proc、/sys和/tmp 目录。注意,这些容器目录的内容将 变得模糊不清。

udocker run -v /var -v /proc -v /sys -v /tmp  myfed  /bin/bash

在容器内安装软件。

udocker run  --user=root myfed  yum install -y firefox pulseaudio gnash-plugin

作为某个用户运行。这个用户名应该存在于容器中。

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory
0

运行Firefox。

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory
1

将执行引擎模式从proot更改为fakechroot并运行。

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory
2

将执行引擎模式更改为加速Proot。

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory
3

将执行引擎更改为runc。

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory
4

将执行引擎更改为奇点。需要可用的 主机系统中的奇点。

Commands:
  search <repo/image:tag>       :Search dockerhub for container images
  pull <repo/image:tag>         :Pull container image from dockerhub
  images                        :List container images
  create <repo/image:tag>       :Create container from a pulled image
  ps                            :List created containers
  rm  <container>               :Delete container
  run <container>               :Execute container
  inspect <container>           :Low level information on container
  name <container_id> <name>    :Give name to container
  rmname <name>                 :Delete name from container

  rmi <repo/image:tag>          :Delete image
  rm <container-id>             :Delete container
  import <tar> <repo/image:tag> :Import tar file (exported by docker)
  import - <repo/image:tag>     :Import from stdin (exported by docker)
  load -i <exported-image>      :Load image from file (saved by docker)
  load                          :Load image from stdin (saved by docker)
  export -o <tar> <container>   :Export container rootfs to file
  export - <container>          :Export container rootfs to stdin
  inspect <repo/image:tag>      :Return low level information on image
  verify <repo/image:tag>       :Verify a pulled image
  clone <container>             :duplicate container

  protect <repo/image:tag>      :Protect repository
  unprotect <repo/image:tag>    :Unprotect repository
  protect <container>           :Protect container
  unprotect <container>         :Unprotect container

  mkrepo <topdir>               :Create repository in another location
  setup                         :Change container execution settings
  login                         :Login into docker repository
  logout                        :Logout from docker repository

  help                          :This help
  run --help                    :Command specific help


Options common to all commands must appear before the command:
  -D                          :Debug
  --repo=<directory>          :Use repository at directory
5

限制

因为根权限不涉及任何真正 要求这样的特权是不可能的。以下是 不可能的操作示例:

  • 访问受主机保护的设备和文件
  • 侦听TCP/IP特权端口(范围低于1024)
  • 装载文件系统
  • su命令将不起作用
  • 更改系统时间
  • 更改路由表、防火墙规则或网络接口

如果容器需要这样的能力,那么应该使用docker 取而代之的是

当前的实现仅限于提取Docker图像 以及它的执行。实际的容器应该使用Docker构建 和文档文件。

udocker没有提供所有的docker特性,也不是有意的 作为Docker的替代品。

使用proot引擎在udocker内部进行调试将无法工作,原因是 proot实现chroot环境的方式

udocker的主要目标是为 在用户空间中执行容器。

udocker特别适合运行封装的用户应用程序 在码头集装箱中。

安全性

由于前一节中描述的限制,udocker可以 不提供Docker提供的隔离功能。如果 容器内容不受信任,则这些容器不应 使用udocker执行,因为它们将在用户环境中运行。

容器数据将被解包并存储在用户主目录中,或者 其他选择地点。因此,容器数据将受到 与用户拥有的其他文件相同的文件系统保护。如果 容器有敏感信息文件和目录应该是 由用户充分保护。

udocker不需要特权,并以用户的身份运行 调用它。

用户可以下载udocker并在不需要系统的情况下执行它。 管理员干预。

udocker via proot提供了对根用户的模拟。这个模拟 模拟一个真正的根用户(例如getuid将返回0)。这只是个模拟 不涉及根权限。此功能使执行 一些不需要实际特权但拒绝 如果用户名或ID不是根或0,则工作。例如,这使得 在容器内使用RPM、YUM或DNF进行软件安装。

由于缺乏隔离,udocker不能由特权用户运行。

其他限制

注意,当使用proot(pn模式)以外的执行引擎时 无法跨主机移动创建的容器。在这种情况下,转换回 传输前进入PN模式。

proot的加速模式(模式p1)在linux内核中可能会出现故障 在4.0以上版本中,由于内核更改和 本案例使用模式P2或任何其他模式。

runc模式需要最近启用了用户名空间的内核。

奇点模式需要主机中奇点的可用性 系统:< /P>

文档

完整文档位于:

贡献

参见:贡献

引用

引用udocker时,请使用以下命令:

  • Jorge Gomes,Emanuele Bagnaschi,Isabel Campos,Mario David,Luís Alves,Jo_o Martins,Jo_o Pina,Alvaro López García,Pablo Orviz,在多用户环境中启用无根Linux容器:Udocker工具,计算机物理通信,2018年6月6日在线提供,ISSN 0010-4655,https://doi.org/10.1016/j.cpc.2018.05.021

致谢

udocker(1.1.3)

  • 在ubuntu上支持nvidia驱动程序
    • 关闭:162
  • 安装改进
    • 关闭:166
  • 修正fn模式符号链转换问题
    • 部分地址:160

udocker(1.1.2)

  • 改进命令行中引号的解析
    • 关闭:98
  • 修复版本命令以使用0退出
    • 关闭:107
  • 在pn模式下将kill on exit添加到proot
  • 改进udocker实用程序的下载
  • 拉取时处理身份验证头
    • 关闭:110
  • 拉动时的重定向句柄
  • 修复注册表表
  • 支持search quay.io
  • 修复未使用标准Docker注册表时的身份验证头
  • 在图像名上添加注册表检测
  • 添加--版本选项
  • 强制python2作为解释程序
    • 关闭:131
  • 修复元数据中卷的处理
  • 处理空元数据
  • 修复http代理功能
    • 关闭:115
  • 忽略--no trunc和--all in the images命令
    • 关闭:108
  • 在清单中实现层的验证
  • add—NVIDIA支持GPU和相关驱动程序
  • 向stderr发送下载消息
  • 启用对curl可执行文件的重写
  • 安装在CentOS 6上
    • 关闭:157
  • 无tty的runc上游限制的缓解
    • 关闭:132
  • 修复对容器中带有符号链接的可执行文件的检测
    • 关闭:118
  • 将runc更新为v1.0.0-rc5
  • fn模式下alpine的实验支持
  • 改进fn模式下挂载dir的路径名转换
    • 部分地址:160

udocker(1.1.1)

  • 使用奇点的新执行引擎
  • 使用openmpi信息和示例更新文档
  • 附加单元测试
  • 将邮件重定向到stderr
  • 改进了命令行中引号的解析
    • 关闭:87
  • 允许重写HOME环境变量
  • 允许在容器级别重写libfakechroot.so
  • 从容器信息中自动选择libfakechroot.so
  • 改进自动安装
  • 启用重置前缀pat远程主机的FN模式下的hs
  • 当主机/tmp是卷时,不要在fn模式下设置af_unix路径
  • 以Docker和Udocker格式导出容器
  • 导入容器docker和udocker格式
  • 加载、导入和导出到/从stdin/stdout
  • 克隆现有容器
  • 在执行模式pn下支持TCP/IP端口重新映射
  • 修复基名失败的运行
    • 关闭:89
  • 允许作为根标志运行
    • 关闭:91

udocker(1.1.0)

  • 支持以注册表为前缀的图像名称,类似于Docker
  • 添加执行引擎选择逻辑
  • 基于共享库拦截添加fr执行引擎
  • 添加基于无根命名空间的rc执行引擎
  • 改进非文本文件系统上的proot tmp文件清理
  • 改进Docker存储库中返回空的搜索
  • 提高runc执行的可移植性
  • 添加环境变量udocker_keystore
    • 关闭:75
  • 使用udocker\u密钥库时防止创建.udocker
    • 关闭:75

udocker(1.0.4)

  • 文档修复

udocker(1.0.3)

  • 支持在更新的元数据结构中导入Docker容器
  • 改进命令行分析
  • 改进临时文件处理和删除
  • 支持将来提供的其他执行引擎
  • 改进了entrypoint和cmd元数据的解析
    • 关闭:53
  • 增加名称别名长度
    • 关闭:52
  • 在卷目录中添加对change dir的支持
    • 关闭:51
  • 修复在容器导入时删除文件的问题
    • 关闭:50
  • 修复将宿主环境变量导出到容器的问题
    • 关闭:48
  • 将导入tarball的误导行为从move改为copy
    • 关闭:44
  • 修正卷规范的验证
    • 关闭:43

udocker(1.0.2)

  • 改进在/v2上未通过身份验证的存储库上的下载
  • 改进具有递归符号链接的二进制文件的运行验证
  • 提高内核上的加速seccomp>;=4.8.0
    • 关闭:40

udocker(1.0.1)

  • 小错误修复
  • 可执行文件名已从udocker.py更改为udocker
  • 添加了对登录Docker存储库的支持
  • 增加了对私有存储库的支持
  • 添加了对列出v2存储库目录的支持
  • 为SHA256层添加校验和验证
  • 改进了v1和v2存储库的下载处理
  • 改进的安装tarball结构
  • 固定的不安全标志
  • 内核上引入的地址seccomp更改>;=4.8.0
  • 包装实用程序
  • 改进了详细级别、消息传递和输出
    • 关闭:24,23
  • 完全实现对注册表选择的支持--注册表参数
    • 关闭:29
  • 为私有存储库提供支持,例如gitlab注册表
    • 关闭:30
  • 为SSL请求提供--不安全的命令行参数
    • 关闭:31

udocker(1.0.0)

  • 初始版本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何从java中链接到数组的数组中删除值。jar文件?   性能记录屏幕Java磁盘速度   java Elastic APM Tomcat zip文件或JAR清单丢失   java无法在eclipse控制台上打印结果   java如何在Android中解析json对象?   java如何更改边缘根类型   java根据一些规则替换EditText中的字母   java项目反应器:是否有类似Nosideeffect finally的方法(不是sideeffect方法doFinally)   java连接Cassandra节点和spark   开源Java作业调度器:远程处理、负载平衡、故障切换、依赖DAG?   使用矢量汇编程序(Java)在Spark中设置输入和输出时出现问题   swing如何在Java中为文本字段创建右键单击菜单?   java查找最近的邻居/纬度和经度   java计算完成的数独板的行和列