Docker找不到文件

时间:2020-05-13 11:15:38

标签: docker dockerfile

我有这个Dockerfile:

FROM ubuntu:18.04

ENV KERNEL /kernel-git
ENV IMAGEDIR /buildroot-git
ENV SYZKALLER /syzkaller-git
ENV SYZKALLER_WORKDIR /syzkaller_workdir
ENV SYZKALLER_DIR $SYZKALLER/gopath/src/github.com/google/syzkaller/
ENV SYZKALLER_BIN $SYZKALLER/gopath/src/github.com/google/syzkaller/bin/

ENV DEBIAN_FRONTEND=noninteractive
WORKDIR .
COPY rootfs.ext3 /buildroot-git/rootfs.ext3
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
    apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && apt-get -y install vim subversion snapd build-essential flex bison libc6-dev libc6-dev-i386 \
       linux-libc-dev libgmp3-dev libmpfr-dev libmpc-dev git debootstrap qemu-system-aarch64 wget sed make binutils gcc g++ bash patch gzip bzip2 perl tar cpio unzip rsync file bc wget git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
RUN DEBIAN_FRONTEND=noninteractive wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-VERSION.tar.xz 
RUN DEBIAN_FRONTEND=noninteractive  apt update && apt -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu golang-go && DEBIAN_FRONTEND=noninteractive  mkdir $KERNEL && tar -xf linux-VERSION.tar.xz -C $KERNEL && cd $KERNEL/linux-VERSION          && \
    ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig && \
    sed -i '/CONFIG_KCOV=/d' .config && \
    sed -i '/CONFIG_KCOV /d' .config && \
    sed -i '/CONFIG_KASAN_INLINE=/d' .config && \
    sed -i '/CONFIG_KASAN_OUTLINE=/d' .config && \
    sed -i '/CONFIG_KASAN_OUTLINE /d' .config && \
    sed -i '/CONFIG_KASAN_INLINE /d' .config && \
    sed -i '/CONFIG_KASAN_INLINE=/d' .config && \
    sed -i '/CONFIG_KASAN=/d' .config && \
    sed -i '/CONFIG_KASAN /d' .config && \
    sed -i '/CONFIG_DEBUG_INFO=/d' .config && \
    sed -i '/CONFIG_DEBUG_INFO /d' .config && \
    sed -i '/CONFIG_KCOV_INSTRUMENT_ALL=/d' .config && \
    sed -i '/CONFIG_KCOV_INSTRUMENT_ALL /d' .config && \
    sed -i '/CONFIG_DEBUG_FS=/d' .config && \
    sed -i '/CONFIG_DEBUG_FS /d' .config && \   
    sed -i '/CONFIG_NET_9P=/d' .config && \
    sed -i '/CONFIG_NET_9P /d' .config && \
    sed -i '/CONFIG_NET_9P_VIRTIO=/d' .config && \
    sed -i '/CONFIG_NET_9P_VIRTIO /d' .config && \
    sed -i '/CONFIG_CROSS_COMPILE=/d' .config && \
    sed -i '/CONFIG_CROSS_COMPILE /d' .config && \
    sed -i '/CONFIG_CMDLINE=/d' .config && \
    sed -i '/CONFIG_CMDLINE /d' .config && \
    sed -i '/CONFIG_HAVE_ARCH_KASAN=/d' .config && \
    sed -i '/CONFIG_HAVE_ARCH_KASAN /d' .config && \
    sed -i '/CONFIG_CONSTRUCTORS=/d' .config && \
    sed -i '/CONFIG_CONSTRUCTORS /d' .config && \
    sed -i '/CONFIG_VMAP_STACK=/d' .config && \
    sed -i '/CONFIG_VMAP_STACK /d' .config && \
    sed -i '/CONFIG_STACKDEPOT=/d' .config && \
    sed -i '/CONFIG_STACKDEPOT /d' .config && \
    sed -i '/CONFIG_KASAN_EXTRA=/d' .config && \
    sed -i '/CONFIG_KASAN_EXTRA /d' .config && \
    sed -i '/CONFIG_TEST_KASAN=/d' .config && \
    sed -i '/CONFIG_TEST_KASAN /d' .config && \
    sed -i '/CONFIG_STACKDEPOT=/d' .config && \
    sed -i '/CONFIG_STACKDEPOT /d' .config && \
    sed -i '/CONFIG_STACKTRACE=/d' .config && \
    sed -i '/CONFIG_STACKTRACE /d' .config && \
    printf 'CONFIG_KCOV=y\nCONFIG_KASAN=y\nCONFIG_KASAN_INLINE=y\nCONFIG_HAVE_ARCH_KASAN=y\nCONFIG_DEBUG_INFO=y\nCONFIG_CMDLINE="console=ttyAMA0"\nCONFIG_KCOV_INSTRUMENT_ALL=y\nCONFIG_DEBUG_FS=y\nCONFIG_NET_9P=y\nCONFIG_NET_9P_VIRTIO=y\nCONFIG_CROSS_COMPILE="aarch64-linux-gnu-"\nCONFIG_CONSTRUCTORS=y\nCONFIG_VMAP_STACK=y\nCONFIG_STACKDEPOT=y\nCONFIG_KASAN_EXTRA=y\n# CONFIG_KASAN_OUTLINE is not set\nCONFIG_TEST_KASAN=m\n#CONFIG_STACKTRACE is not set\n' >> .config && \
        yes | make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- oldconfig && \
    ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) && \
    mkdir $SYZKALLER && cd $SYZKALLER \
    mkdir gopath && \
    export GOPATH=`pwd`/gopath && \
    export PATH=$GOPATH/bin:$PATH && \
    go get -u -d github.com/google/syzkaller/prog && \
    cd $SYZKALLER/gopath/src/github.com/google/syzkaller/ && \
    make && printf '{\n    "name": "QEMU-aarch64",\n    "target": "linux/arm64",\n    "http": ":56700",\n    "workdir": "$SYZKALLER_WORKDIR",\n    "syzkaller": "$SYZKALLER/gopath/src/github.com/google/syzkaller/",\n    "image": "$IMAGEDIR/rootfs.ext3",\n    "procs": 8,\n    "type": "qemu",\n    "vm": {\n        "count": 1,\n        "qemu": "qemu-system-aarch64",\n        "cmdline": "console=ttyAMA0 root=/dev/vda",\n        "kernel": "$KERNEL/arm64/boot/Image",\n        "cpu": 2,\n        "mem": 2048\n    }\n}\n' >> $SYZKALLER/gopath/src/github.com/google/syzkaller/arm64.conf && \
    ./syzkaller-git/gopath/src/github.com/google/syzkaller/bin/syz-manager -config $SYZKALLER/gopath/src/github.com/google/syzkaller/arm64.conf

如您所见,我正在编译一个go应​​用程序。 当我尝试运行最后一条命令时,它失败并显示以下错误:

/bin/sh: 1:  /syzkaller-git/gopath/src/github.com/google/syzkaller/bin/syz-manager: not found

我检查了文件是否确实存在并且确实存在。 试图看网上,但没有任何帮助。 我还尝试将这一特定命令与单行RUN命令分开,但这没有帮助。

1 个答案:

答案 0 :(得分:0)

您已经在此路径@Override protected void onStart() { super.onStart(); String webAdres = getIntent().getStringExtra("link"); //get link from firebase try { webView.loadUrl(webAdres); } catch (Exception e){ e.printStackTrace(); } }

Dockerfile

$SYZKALLER/gopath/src/github.com/google/syzkaller/

,您正在尝试访问该路径中的文件

cd $SYZKALLER/gopath/src/github.com/google/syzkaller/ && \

似乎您需要将以上内容更新为绝对路径或使用

之类的命令
./syzkaller-git/gopath/src/github.com/google/syzkaller/bin/syz-manager