Docker - 在Mac上构建rpi图像 [英] Docker - Build rpi image on Mac
问题描述
模拟完整的备用架构一般很慢 QEMU 是什么让您在Linux上执行此操作,可以集成到Docker容器中。
对于构建,您可以使用 QEMU用户仿真,比完全仿真快得多。这允许您的硬件直接执行ARM二进制文件,并用于简化交叉编译和交叉调试。
第一个获取VirtualBox 和获取Vagrant 并安装。 (或使用 docker-machine
从 Docker工具箱)
设置您的VM
mkdir raspbian-docker
cd raspbian-docker
vagrant init debian / jessie64
vagrant up
vagrant ssh
现在你在你的Debian Linux VM上,设置Docker主机
sudo su -
apt-get install qemu-user-static
curl https:// get .docker.com / | sh
运行raspbian环境
docker run -ti \
--volume / usr / bin / qemu-arm-static:/ usr / bin / qemu-arm-static \
philipz / rpi-raspbian \
bash
并做你所需要的。
然后,您可以 docker export
和 docker import
来移动图片。您还可以使用中心或设置注册表使用 push
/ 拉
Docker Toolbox 还将允许您通过Mac上的VirtualBox VM轻松地运行Docker,但是遇到更多的麻烦,而不是值得(当您有流氓安装时)。 / p>
This could be more generic and be building an image for architecture B with a machine architecture A. I currently want to create an image with lot of Python dependencies. Which take time on raspberry-pi but is faster on Mac. When I get an error at the end well need to rebuild. Is there a way to build this image on Mac and then pull it on my raspberry pi ?
Emulating a full alternate architecture is generally very slow. QEMU is what allows you to do this on Linux and can be integrated into a Docker container.
For building, you can use QEMU User Emulation which is much quicker than full emulation. This allows your hardware to execute ARM binaries directly and is used to ease cross-compilation and cross-debugging.
First get VirtualBox and get Vagrant and install. (Or use docker-machine
from the Docker Toolbox)
Setup your VM
mkdir raspbian-docker
cd raspbian-docker
vagrant init debian/jessie64
vagrant up
vagrant ssh
Now you are on your Debian Linux VM, setup the Docker host
sudo su -
apt-get install qemu-user-static
curl https://get.docker.com/ | sh
Run a raspbian environment
docker run -ti \
--volume /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static \
philipz/rpi-raspbian \
bash
And do what you need to.
Then you can docker export
and docker import
to move images around. You can also use the hub or setup a registry to use push
/pull
The Docker Toolbox will also allow you to easily run Docker via a VirtualBox VM on mac but I've run into more troubles than it's been worth (when you have vagrant setup).
这篇关于Docker - 在Mac上构建rpi图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!