日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

arm linux docker,ARM64上的Docker编译与安装

發(fā)布時(shí)間:2023/12/20 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 arm linux docker,ARM64上的Docker编译与安装 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

ARM64已經(jīng)成為手機(jī)上的主流,而且開始進(jìn)入服務(wù)器領(lǐng)域(中國(guó)的全志、輝騰等芯片也都是ARM架構(gòu)),很多開發(fā)板也相繼推出。為了充分發(fā)揮其能力,我希望能在上面運(yùn)行Docker。但是,目前雖然ARM32上面已經(jīng)有多個(gè)Docker移植版本,但是ARM64上找不到現(xiàn)成的(96Boards的系統(tǒng)包含的Docker無法使用),需要自己編譯(Docker官網(wǎng)已經(jīng)包含編譯支持)。下面是一些找到的資源,先抓下來,后面再慢慢測(cè)試。

在96Board上編譯,注意:

更新源,運(yùn)行:sudo apt update

安裝Docker,運(yùn)行: sudo apt install docker-engine

讓Docker在用戶空間運(yùn)行:sudo usermod -aG docker linaro

1G內(nèi)存的CE版96Board在編譯go時(shí)會(huì)出現(xiàn)“can't allocate memory”錯(cuò)誤,參考這里添加虛存解決:https://my.oschina.net/u/2306127/blog/657269

編譯之前不要運(yùn)行 sudo apt upgrade,因?yàn)槟壳癲ocker源只有1.9.1版本,如果系統(tǒng)其它褲更新到了新版,可能導(dǎo)致Docker無法運(yùn)行。在編譯安裝完新版Docker(1.12以后版本)后,再去更新系統(tǒng)。

我按照DieterReuter的方法進(jìn)行編譯(直接在host中編譯),后來出現(xiàn)內(nèi)存分配失敗退出。然后直接進(jìn)入~/home/src/docker里面運(yùn)行 make deb 編譯,這是在docker容器里面編譯的。

首先獲取腳本代碼:

git clone https://github.com/DieterReuter/arm64-docker-builder.git

下面是來自于DieterReuter的編譯指南(是針對(duì)Qemu中虛擬機(jī)的):

arm64-docker-builder

This repo contains all necessary details and scripts how to compile Docker on an ARM64 (or AARCH64) machine which is running Ubuntu 15.04. This works well, even in a QEMU emulated AARCH64 machine with an Ubuntu 15.04 Cloud Image for ARM64. I've tested all these steps with a QEMU box which could be run with the help of vagrant in VirtualBox or on DigitalOcean with the following repo https://github.com/DieterReuter/qemu-arm-box.

Background

For the last six months or so, I was working hard in my spare time to get Docker running easily for some ARM 32bit systems like the Raspberry Pi. For this year there should be a few new ARM devices coming on the market with 64bit CPUs, and I'd like to get Docker running on these ARM64 devices as soon as possible.

I don't have any ARM64 machine at hand, so I tried to set up a QEMU emulated ARM64 (aka AARCH64) in a reproducible way. I choose Vagrant and created a box running Ubuntu 15.04. With the help of Vagrant it was easy to set up such a box in a local VirtualBox (on my MacBookPro) and also the same way on a DigitalOcean Droplet. I think, now it's easy for everybody to spin up such a QEMU ARM64 box within 5 or 10 minutes on your local machine or in the cloud.

Prerequisites

If you don't have an ARM64 machine at hand like me, you have to create a QEMU box first. This can be done with my repo https://github.com/DieterReuter/qemu-arm-box. Once your ARM64 machine is up and running, just login and go ahead.

Step 1 - install dependencies

First we have to install some development dependencies like Git, Curl, GOLANG and some more specific dependencies for Docker like btrfs, sqlite and devmapper. Please keep in mind, this can take a serious long time on a QEMU emulated machine.

$ ./install-arm64-devtools.sh

Maybe if you run into trouble that the install process gets interrupted while generating a new /boot/initrd.img, you can fix this with the following commands (of course inside the ARM64 machine):

$ sudo dpkg --configure -a --force-depends

$ sudo apt-get install -f

OK, let's skip all these problems for now and just ignore it. For a QEMU machine it could also happens that we have to reboot the machine. At least, we should check, if our dependent packages are already installed:

$ dpkg -l | grep -E "btrfs-tools|libsqlite3-dev|libdevmapper-dev"

ii btrfs-tools 3.17-1.1 arm64 Checksumming Copy on Write Filesystem utilities

ii libdevmapper-dev:arm64 2:1.02.90-2ubuntu1 arm64 Linux Kernel Device Mapper header files

ii libsqlite3-dev:arm64 3.8.7.4-1 arm64 SQLite 3 development files

OK, everything is there. Let's go ahead and compile Docker.

Step 2 - compile the latest version of Docker

The compile script will first clone into the docker/docker repo, so this will take some time. But don't worry for subsequent builds the script just fetches only the latest changes which is much faster. The compile time depends on your host machine and takes around 5 to 20 minutes, the later on a QEMU emulated machine on DigitalOcean; on a local VirtualBox machine it could be faster. And on real hardware you should get the best performance - but who has already an ARM64 power horse at hand?

$ ./compile-docker.sh

Fetch latest changes of docker/docker repository

Previous HEAD position was 7ddecf7... Bump version to v1.7.0

Switched to branch 'master'

Your branch is up-to-date with 'origin/master'.

Docker version=v1.7.0-rc2

Note: checking out 'v1.7.0-rc2'.

You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 7ddecf7... Bump version to v1.7.0

# WARNING! I don't seem to be running in the Docker container.

# The result of this command might be an incorrect build, and will not be

# officially supported.

#

# Try this instead: make all

#

---> Making bundle: dynbinary (in bundles/1.7.0-rc2/dynbinary)

go build: when using gccgo toolchain, please pass linker flags using -gccgoflags, not -ldflags

Created binary: bundles/1.7.0-rc2/dynbinary/dockerinit-1.7.0-rc2

Building: bundles/1.7.0-rc2/dynbinary/docker-1.7.0-rc2

go build: when using gccgo toolchain, please pass linker flags using -gccgoflags, not -ldflags

Created binary: bundles/1.7.0-rc2/dynbinary/docker-1.7.0-rc2

Here are our fresh build artifacts:

$ ls -al bundles/1.7.0-rc2/dynbinary/

total 21052

drwxrwxr-x 2 ubuntu ubuntu 4096 Jun 7 13:13 .

drwxrwxr-x 3 ubuntu ubuntu 4096 Jun 7 12:54 ..

lrwxrwxrwx 1 ubuntu ubuntu 16 Jun 7 13:13 docker -> docker-1.7.0-rc2

-rwxrwxr-x 1 ubuntu ubuntu 17582904 Jun 7 13:13 docker-1.7.0-rc2

-rw-rw-r-- 1 ubuntu ubuntu 51 Jun 7 13:13 docker-1.7.0-rc2.md5

-rw-rw-r-- 1 ubuntu ubuntu 83 Jun 7 13:13 docker-1.7.0-rc2.sha256

lrwxrwxrwx 1 ubuntu ubuntu 20 Jun 7 12:58 dockerinit -> dockerinit-1.7.0-rc2

-rwxrwxr-x 1 ubuntu ubuntu 3945424 Jun 7 12:58 dockerinit-1.7.0-rc2

-rw-rw-r-- 1 ubuntu ubuntu 55 Jun 7 12:58 dockerinit-1.7.0-rc2.md5

-rw-rw-r-- 1 ubuntu ubuntu 87 Jun 7 12:58 dockerinit-1.7.0-rc2.sha256

If you like, you can also build a specific release version of Docker:

$ ./compile-docker.sh 1.7.0-rc1

Step 3 - quickly test the compiled Docker binary

$ ./bundles/1.7.0-rc2/dynbinary/docker-1.7.0-rc2 version

Client version: 1.7.0-rc2

Client API version: 1.19

Go version (client): go1.4.2 gccgo (Ubuntu 5.1~rc1-0ubuntu1) 5.0.1 20150414 (prerelease) [gcc-5-branch revision 222102]

Git commit (client): 7ddecf7

OS/Arch (client): linux/arm64

Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

Success, it runs in client mode and the arch type is linux/arm64.

Further steps

The next steps should be to get the Docker engine running in daemon mode on the ARM64 machine. But I think, this will take some more time to adjust the appropriate kernel options, include all needed kernel modules like Overlay filesystem and so on. And maybe also a serious amount of testing and possibly setting up a completely automated build server for compiling and testing Docker on ARM64 machines. This should get even better as soon as we have some real hardware to speed up the dev-test cycles.

Have fun to use this tutorial as a starting point, and please share your experience with me.

總結(jié)

以上是生活随笔為你收集整理的arm linux docker,ARM64上的Docker编译与安装的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。