是否有相当于 docker run 的 enroot ?

问题描述 投票:0回答:1

我有一个简单的容器,是用 Dockerfile 构建的。我正在

Ubuntu-20.04
上运行,还有
enroot-3.4.1-1
Docker version 26.0.0

我的

Dockerfile
采用一个简单的可执行文件(从C编译)并打印出“Hello World”,即:

# syntax=docker/dockerfile:1
FROM scratch
ADD hello /
CMD ["./hello"]

我可以运行这个图像:

root@head01:/home/user/Scratch# docker image ls
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello         latest    d08237299659   7 hours ago     872kB
.
.
.
root@head01:/home/user/Scratch# docker run hello
Hello World

我通过以下方式将

docker
图像导出到squashfs文件:

root@head01:~# mkdir dockerout
root@head01:~# docker export optimistic_almeida | tar -C dockerout -p -s --same-owner -xv .dockerenv
root@head01:~# mksquashfs dockerout hello.sqsh

现在如果我尝试用

enroot

运行它
root@head01:/home/user/Scratch# enroot start hello.sqsh
enroot-switchroot: failed to execute: /bin/sh: No such file or directory

问题:

  1. 是否有一个
    enroot
    相当于
    docker run
    ,只是执行
    CMD
    形式的
    Dockerfile
    ?看起来
    enroot
    想要一个交互式会话,但我不认为我为其构建了 shell。
docker hpc
1个回答
0
投票

使用 enroot 启动容器时,可以在命令后添加 --root 选项。

enroot start --root=/ hello.sqsh ./hello

该命令告诉 enroot 启动容器 hello.sqsh 并在其中执行 ./hello 命令。

© www.soinside.com 2019 - 2024. All rights reserved.