文档章节

ARM64上Docker编译问题与解决

openthings
 openthings
发布于 2016/12/10 10:55
字数 1587
阅读 62
收藏 1
点赞 0
评论 0

编译过程

在96Boards 的410C上编译Docker(这里使用Dokcer 1.14 Master版本,方法参考),遇到些问题,解决方法如下:

修改Docker源码目录下的Dockerfile.aarch64文件

  • 修改 FROM aarch64/ubuntu:wily 去掉wily,因为wily版很多源都没法下载。
  • Docker编译需要GOROOT_BOOTSTRAP,在安装包中加入: golang
  • 在docker-py安装前运行:pip install setuptools
  • 需要下载go的源代码安装,访问不了的设置代理,示意:curl -x 192.168.1.11:9999,把这里的地址改成自己的代理服务器。
  • 内存不足,启用虚存支持,参考:https://my.oschina.net/u/2306127/blog/657269
  • 主存储空间不足,把Docker放到U盘或SD卡上,参考:https://my.oschina.net/u/2306127/blog/653569

** 基于ARM64的很多容器资源:https://github.com/multiarch**

运行问题解决

因为不明原因,最后make deb编译失败,但到目录中看,bundles中dockerD和docker都已经生成好了。

  • 拷贝到/usr/bin目录中,修改/lib/systemd/system/docker.service文件。
  • 但systemctl docker start运行时又报container找不到错误。
  • 到 **hack/dockerfile/install-binaries.sh **中找到containerd和runc的相应安装代码,手工运行、安装到/usr/local/bin,建立软连接,docker就可以正常启动了。

注意:

  • 由于最近github.com强制使用了https,导致go get和git clone 原来的http网站失败。
  • 出错显示,网站找不到,参考这里的方法解决。
SSL CA错误的解决:
运行:git config --global http.sslverify false.
或者:env GIT_SSL_NO_VERIFY=true
添加CA:http://askubuntu.com/questions/645818/how-to-install-certificates-for-command-line

安装containerd和runc

export GOPATH="/home/linaro" 

#复制DockerD服务器到系统目录
cp docker1.14.0-dev /usr/bin/
#修改/lib/systemd/system/docker.service中的ExecStart=/usr/bin/dockerd为ExecStart=/usr/bin/docker1.14.0-dev

#以后使用dox来运行新的Docker客户端。
cp  docker1.14.0 /usr/local/bin/dox
 
# Install runc
export RUNC_COMMIT=f59ba3cdd76fdc08c004f42aa915996f6f420899
git clone https://github.com/docker/runc.git "$GOPATH/src/github.com/opencontainers/runc"
cd "$GOPATH/src/github.com/opencontainers/runc"
git checkout -q "$RUNC_COMMIT"
make static BUILDTAGS="seccomp apparmor selinux" 
cp runc /usr/local/bin/docker-runc
ln -s /usr/local/bin/docker-runc /usr/local/bin/runc

# Install containerd
export CONTAINERD_COMMIT=2a5e70cbf65457815ee76b7e5dd2a01292d9eca8
git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd" 
cd "$GOPATH/src/github.com/docker/containerd"
git checkout -q "$CONTAINERD_COMMIT"
make static
cp bin/containerd /usr/local/bin/docker-containerd
ln -s /usr/local/bin/docker-containerd  /usr/local/bin/containerd

cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
ln -s /usr/local/bin/docker-containerd-shim /usr/local/bin/containerd-shim

cp bin/ctr /usr/local/bin/docker-containerd-ctr
ln -s /usr/local/bin/docker-containerd-ctr /usr/local/bin/containerd-ctr

修改的docker.service文件

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID

# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process

[Install]
WantedBy=multi-user.target

修改的Dockerfile.aarch64文件

下面是修改过的Dockerfile.aarch64,查看原始文件

# This file describes the standard way to build Docker on aarch64, using docker
#
# Usage:
#
# # Assemble the full dev environment. This is slow the first time.
# docker build -t docker -f Dockerfile.aarch64 .
#
# # Mount your source in an interactive container for quick testing:
# docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash
#
# # Run the test suite:
# docker run --privileged docker hack/make.sh test-unit test-integration-cli test-docker-py
#
# Note: AppArmor used to mess with privileged mode, but this is no longer
# the case. Therefore, you don't have to disable it anymore.
#

FROM aarch64/ubuntu:wily

# Packaged dependencies
RUN apt-get update && apt-get install -y \
	apparmor \
	aufs-tools \
	automake \
	bash-completion \
	btrfs-tools \
	build-essential \
	cmake \
	createrepo \
	curl \
	dpkg-sig \
	g++ \
	gcc \
	git \
	iptables \
	jq \
	libapparmor-dev \
	libc6-dev \
	libcap-dev \
	libltdl-dev \
	libsqlite3-dev \
	libsystemd-dev \
	mercurial \
	net-tools \
	parallel \
	pkg-config \
	python-dev \
	python-mock \
	python-pip \
	python-websocket \
	gccgo \
        golang \
	iproute2 \
	iputils-ping \
	vim-common \
	--no-install-recommends

# Get lvm2 source for compiling statically
ENV LVM2_VERSION 2.02.103
RUN mkdir -p /usr/local/lvm2 \
	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
		| tar -xzC /usr/local/lvm2 --strip-components=1
# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags

# Fix platform enablement in lvm2 to support aarch64 properly
RUN set -e \
	&& for f in config.guess config.sub; do \
		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
	done
# "arch.c:78:2: error: #error the arch code needs to know about your machine type"

# Compile and install lvm2
RUN cd /usr/local/lvm2 \
	&& ./configure \
		--build="$(gcc -print-multiarch)" \
		--enable-static_link \
	&& make device-mapper \
	&& make install_device-mapper
# See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL

# Install seccomp: the version shipped in trusty is too old
ENV SECCOMP_VERSION 2.3.1
RUN set -x \
	&& export SECCOMP_PATH="$(mktemp -d)" \
	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
	&& ( \
		cd "$SECCOMP_PATH" \
		&& ./configure --prefix=/usr/local \
		&& make \
		&& make install \
		&& ldconfig \
	) \
	&& rm -rf "$SECCOMP_PATH"

# Install Go
# We don't have official binary tarballs for ARM64, eigher for Go or bootstrap,
# so we use gccgo as bootstrap to build Go from source code.
# We don't use the official ARMv6 released binaries as a GOROOT_BOOTSTRAP, because
# not all ARM64 platforms support 32-bit mode. 32-bit mode is optional for ARMv8.
ENV GO_VERSION 1.7.4
RUN mkdir /usr/src/go && curl -x 192.168.1.11:9999 -fsSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/src/go -xz --strip-components=1 \
	&& cd /usr/src/go/src \
	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash

ENV PATH /usr/src/go/bin:$PATH
ENV GOPATH /go

# Only install one version of the registry, because old version which support
# schema1 manifests is not working on ARM64, we should skip integration-cli
# tests for schema1 manifests on ARM64.
ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827
RUN set -x \
	&& export GOPATH="$(mktemp -d)" \
	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
	&& rm -rf "$GOPATH"

# Install notary and notary-server
ENV NOTARY_VERSION v0.4.2
RUN set -x \
	&& export GOPATH="$(mktemp -d)" \
	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_VERSION") \
	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
	&& GOPATH="$GOPATH/src/github.com/docker/notary/vendor:$GOPATH" \
		go build -o /usr/local/bin/notary github.com/docker/notary/cmd/notary \
	&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT e2655f658408f9ad1f62abdef3eb6ed43c0cf324
RUN git clone https://github.com/docker/docker-py.git /docker-py \
	&& cd /docker-py \
	&& git checkout -q $DOCKER_PY_COMMIT \
	&& pip install -r test-requirements.txt

# Set user.email so crosbymichael's in-container merge commits go smoothly
RUN git config --global user.email 'docker-dummy@example.com'

# Add an unprivileged user to be used for tests which need it
RUN groupadd -r docker
RUN useradd --create-home --gid docker unprivilegeduser

VOLUME /var/lib/docker
WORKDIR /go/src/github.com/docker/docker
ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux

# Let us use a .bashrc file
RUN ln -sfv $PWD/.bashrc ~/.bashrc

# Register Docker's bash completion.
RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker

# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
	aarch64/buildpack-deps:jessie@sha256:6aa1d6910791b7ac78265fd0798e5abd6cb3f27ae992f6f960f6c303ec9535f2 \
	aarch64/busybox:latest@sha256:b23a6a37cf269dff6e46d2473b6e227afa42b037e6d23435f1d2bc40fc8c2828 \
	aarch64/debian:jessie@sha256:4be74a41a7c70ebe887b634b11ffe516cf4fcd56864a54941e56bb49883c3170 \
	aarch64/hello-world:latest@sha256:65a4a158587b307bb02db4de41b836addb0c35175bdc801367b1ac1ddeb9afda
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)

# Install tomlv, vndr, runc, containerd, tini, docker-proxy
# Please edit hack/dockerfile/install-binaries.sh to update them.
COPY hack/dockerfile/binaries-commits /tmp/binaries-commits
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh
RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy

# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]

# Upload docker source
COPY . /go/src/github.com/docker/docker

© 著作权归作者所有

共有 人打赏支持
openthings
粉丝 241
博文 877
码字总数 459280
作品 1
东城
架构师
ARM64上的Docker编译与安装

ARM64已经成为手机上的主流,而且开始进入服务器领域(中国的全志、辉腾等芯片也都是ARM架构),很多开发板也相继推出。为了充分发挥其能力,我希望能在上面运行Docker。但是,目前虽然ARM32...

openthings ⋅ 2016/12/08 ⋅ 0

[NodeJS for Android]完美编译大全

NodeJS for Android完美编译大全 完美地编译了NodeJS for android-{arm,arm64,x86,x64,mipsel},并且提供预编译版,和作为持续编译环境的Docker image。 完美, 意思是不去掉任何功能(不加选项)...

Q_J ⋅ 2016/09/08 ⋅ 0

做了个工具android-gcc-toolchain方便使用NDK

自从第一次用NDK时写了拒绝ndk-build,过了两年了,也没有看到自己想要的工具,忍不了了,就想着有时间时写一个,就是写bash而已,不过我对bash不熟,磕磕碰碰花了不少时间,汗。(2016/09/08...

Q_J ⋅ 2016/08/11 ⋅ 0

96Boards(410C)中的Docker使用方法

ARM64已经成为手机上的主流,而且开始进入服务器领域(中国的全志、辉腾等芯片也都是ARM架构),很多开发板也相继推出。为了充分发挥其能力,我希望能在上面运行Docker。但是,目前虽然ARM32...

openthings ⋅ 2016/12/09 ⋅ 0

从零开始手敲次世代游戏引擎(Android特别篇)-1

本篇开始我们将我们开发的引擎移植到Android上面去。 首先我们需要构建Android的开发环境。无论是基于Windows的Visual Studio,还是基于mac OS的XCode,亦或是基于java的Eclipse,以及googl...

陈文礼 ⋅ 01/08 ⋅ 0

iOS :undefined symbols for architecture x86_64

为了适配iPhone 5s的64位处理器,在编译选项中加入了arm64架构。但是发现工程在真机上可以编译通过但是在模拟器上却未编过。 问题解决:经研究在编译选项中再加入x86_64架构,重新编译工程就...

netmouse ⋅ 2015/08/06 ⋅ 0

提问高手:在老设备运行正常的程序,放到IPAD AIR(ARM64)上,播放MP4就出现黑屏只有声音的情况。

最近维护一个IOS项目,之前非ARM64位处理器的苹果设备上,播放一个MP4文件都能够正常播放,但是近期把这个程序安装到IPAD AIR(IOS版本7.04)上,就只有声音,没有画面(虽然黑屏,但是有显示...

leeking ⋅ 2014/01/20 ⋅ 3

动态加载so注意事项&案例

常用架构 加载so的两种方式 打包在apk中的情况,不需要开发者自己去判断ABI,Android系统在安装APK的时候,不会安装APK里面全部的SO库文件,而是会根据当前CPU类型支持的ABI,从APK里面拷贝最...

编程之乐 ⋅ 2017/11/11 ⋅ 0

Apple移动设备处理器指令集 armv6、armv7、armv7s及arm64

一、概要 平时项目开发中,可能使用第三方提供的静态库.a,如果.a提供方技术不成熟,使用的时候就会出现问题,例如: 在真机上编译报错:No architectures to compile for (ONLYACTIVEARCH=Y...

SunGiantor ⋅ 2015/05/20 ⋅ 0

解决JNI在Windows环境下因长路径导致编译失败问题

之前听一个朋友反馈LuaScriptoCore在Windows下编译会报错,今天特意跑到Windows环境下测试了一番,果然是存在问题。得到了下面的编译报错信息: Build command failed. Error while executin...

杰嗒嗒的阿杰 ⋅ 05/04 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

Jenkins实践3 之脚本

#!/bin/sh# export PROJ_PATH=项目路径# export TOMCAT_PATH=tomcat路径killTomcat(){pid=`ps -ef | grep tomcat | grep java|awk '{print $2}'`echo "tom...

晨猫 ⋅ 今天 ⋅ 0

Spring Bean的生命周期

前言 Spring Bean 的生命周期在整个 Spring 中占有很重要的位置,掌握这些可以加深对 Spring 的理解。 首先看下生命周期图: 再谈生命周期之前有一点需要先明确: Spring 只帮我们管理单例模...

素雷 ⋅ 今天 ⋅ 0

zblog2.3版本的asp系统是否可以超越卢松松博客的流量[图]

最近访问zblog官网,发现zlbog-asp2.3版本已经进入测试阶段了,虽然正式版还没有发布,想必也不久了。那么作为aps纵横江湖十多年的今天,blog2.2版本应该已经成熟了,为什么还要发布这个2.3...

原创小博客 ⋅ 今天 ⋅ 0

聊聊spring cloud的HystrixCircuitBreakerConfiguration

序 本文主要研究一下spring cloud的HystrixCircuitBreakerConfiguration HystrixCircuitBreakerConfiguration spring-cloud-netflix-core-2.0.0.RELEASE-sources.jar!/org/springframework/......

go4it ⋅ 今天 ⋅ 0

二分查找

二分查找,也称折半查找、二分搜索,是一种在有序数组中查找某一特定元素的搜索算法。搜素过程从数组的中间元素开始,如果中间元素正好是要查找的元素,则搜素过程结束;如果某一特定元素大于...

人觉非常君 ⋅ 今天 ⋅ 0

VS中使用X64汇编

需要注意的是,在X86项目中,可以使用__asm{}来嵌入汇编代码,但是在X64项目中,再也不能使用__asm{}来编写嵌入式汇编程序了,必须使用专门的.asm汇编文件来编写相应的汇编代码,然后在其它地...

simpower ⋅ 今天 ⋅ 0

ThreadPoolExecutor

ThreadPoolExecutor public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, ......

4rnold ⋅ 昨天 ⋅ 0

Java正无穷大、负无穷大以及NaN

问题来源:用Java代码写了一个计算公式,包含除法和对数和取反,在页面上出现了-infinity,不知道这是什么问题,网上找答案才明白意思是负的无穷大。 思考:为什么会出现这种情况呢?这是哪里...

young_chen ⋅ 昨天 ⋅ 0

前台对中文编码,后台解码

前台:encodeURI(sbzt) 后台:String param = URLDecoder.decode(sbzt,"UTF-8");

west_coast ⋅ 昨天 ⋅ 0

实验楼—MySQL基础课程-挑战3实验报告

按照文档要求创建数据库 sudo sercice mysql startwget http://labfile.oss.aliyuncs.com/courses/9/createdb2.sqlvim /home/shiyanlou/createdb2.sql#查看下数据库代码 代码创建了grade......

zhangjin7 ⋅ 昨天 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部