Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

制作docker镜像时遇到的问题 #39

Open
maikebing opened this issue Nov 8, 2022 · 6 comments
Open

制作docker镜像时遇到的问题 #39

maikebing opened this issue Nov 8, 2022 · 6 comments

Comments

@maikebing
Copy link

FROM ubuntu:16.04
LABEL author maikebing <mysticboy@live.com>
# docker run -ti   --net=host --rm -e DISPLAY=host.docker.internal:0 -v /tmp/.X11-unix:/tmp/.X11-unix  x11ubuntu   --gpus
ENV DEBIAN_FRONTEND noninteractive
# RUN apt-get -y   -q   update && apt-get  install  -y   -q  apt-transport-https ca-certificates  
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse " > /etc/apt/sources.list && \
    echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
    echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list && \
    apt-get -yq update &&  apt-get install  -y   -q   ca-certificates  wget bzip2  && \
    apt-get clean && apt-get autoremove   && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*	

RUN wget -c  https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/20210903/qemu-x86_64-to-loongarch64 && cp qemu-x86_64-to-loongarch64 /bin/qemu-loongarch64
RUN cd /tmp && wget  -cq https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/20210903/loongarch64-clfs-system-20210903.tar.bz2 && \
    cd /opt  &&  mkdir clfs-os &&  cd clfs-os  && tar xvpf /tmp/loongarch64-clfs-system-20210903.tar.bz2 && rm  /tmp/loongarch64-clfs-system-20210903.tar.bz2
RUN echo  "none  /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0" >> /etc/fstab && \
    mount -t binfmt_misc none /proc/sys/fs/binfmt_misc && \
    echo ":qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/bin/qemu-loongarch64:" > /proc/sys/fs/binfmt_misc/register    
RUN  ls /proc/sys/fs/binfmt_misc/ &&  cat /proc/sys/fs/binfmt_misc/status  
RUN cp /bin/qemu-loongarch64 /opt/clfs-os/bin/
RUN chroot /opt/clfs-os


@maikebing
Copy link
Author

docker 中无法 执行 mount -t binfmt_misc none /proc/sys/fs/binfmt_misc , 提示无权限。
如果有人知道怎么回事 帮忙回复一下 。

@sunhaiyong1978
Copy link
Owner

mount需要root用户权限吧。

@maikebing
Copy link
Author

docker里面本身就是root权限。

@maikebing
Copy link
Author

如果我理解没问题的话

@sunhaiyong1978
Copy link
Owner

你这是在给主系统的内核进行设置。

@maikebing
Copy link
Author

谢谢提醒。

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants