文档章节

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

openthings
 openthings
发布于 2016/12/09 08:13
字数 1181
阅读 166
收藏 1

ARM64已经成为手机上的主流,而且开始进入服务器领域(中国的全志、辉腾等芯片也都是ARM架构),很多开发板也相继推出。为了充分发挥其能力,我希望能在上面运行Docker。但是,目前虽然ARM32上面已经有多个Docker移植版本,但是ARM64上很多不可用。下面是96Boards(410C)的系统中Docker使用方法,目前只有1.9.1版本,更新版本需要自己安装源码编译(参考:https://my.oschina.net/u/2306127/blog/801867)。

注意:

以下内容来自于:https://github.com/96boards/documentation/blob/master/ConsumerEdition/CE-Extras/DockerCE.md,查看最新版本信息,请看原文。

Instructions for Installing Docker on a Consumer Edition 96Boards

This document will show you how to install and test the Debian Docker apt package on the 96Boards with 1GB RAM using the Reference Platform Build 16.03 which is available here. This document was created for Docker v1.9.1.

This material was covered in our 6th OpenHours session and can be paired with this blog.

First of all you need a kernel on your 96Boards which meets the Docker requirements. To check the kernel support for Docker, you can run the following script

$ sudo ./check-config.sh .

This script can be found in /usr/share/docker/ or /usr/share/docker.io/contrib, or on github at https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh

The output of the script is a Docker critique of your kernel config. For the 16.03 Reference Platform Build kernel, the results should look like this:

Image1

This was the standard 96Boards kernel from the 16.03 Reference Platform Build, it meets all the mandatory requirements.

With the overlays for the Reference Platform Build, you can run Docker on Debian Jessie, this is the distro version supported by the Reference Platform Build. You are now ready to install Docker. The instructions on docker.com point you to adding x86-based package repos to sources.list.d, which is problematic for obvious reasons. Please skip those and use the standard Debian repositories with:

$ sudo apt-get install docker-engine

This will install Docker version 1.9.1.

Running Docker

Docker installs a daemon and a client. To start with daemon enter the following:

$ sudo service docker start

Docker is not very architecture aware, yet. In fact, running the following command on an ARM-based system will give you a FATAL “Cannot start container” error:

$ docker run -ti ubuntu /bin/bash

This is because Docker tried to run an x86 container image from hub.docker.com on your ARM hardware. You need to explicitly reference Docker images for the aarch64 architecture, or roll your own. The Docker Hub repository has some ‘experimental’ images for aarch64 which worked fine for me.

Running a first container is a case of:

$ sudo docker run -it aarch64/ubuntu /bin/bash

Image2

This will fetch an image for Ubuntu Xenial from the aarch64 directory at hub.docker.com, and launch it with a shell interactively. Once the image is launched it is called a container and has a container ID. From the container command line prompt, if you type e.g.

$ cat /etc/apt/sources.list

You should see that you’re in an Ubuntu image rather than the Debian Stretch host. Exiting the shell kills and removes the container. You can launch the same image several times with docker run to have several independent containers.

Here are two Ubuntu docker containers running on this 96Boards example. The following command will list all running containers and their status:

$ sudo docker ps

Although this document shows the same image for both, they are separate running instances and have different container IDs

Image2

(Note: you can create a docker group to avoid having to sudo everything)

Building a Docker Base Image

You can create a new Docker base image (an image which does not depend on another Docker image) for a Debian-based distro using debootstrap.

Here you will see how to do it with a base Stretch aarch64 Docker image.

This example uses a USB thumb drive (at /dev/sda1) on a 96Boards to avoid running out of storage space. The USB drive needs to be mounted with -o exec.

$ sudo apt-get install debootstrap
$ sudo umount /dev/sda1
$ sudo mount -o exec /dev/sda1 /media/linaro/thumb
$ sudo debootstrap --arch arm64 stretch /media/linaro/thumb/stretch

Debootstrap needs to be told to create an arm64 (aarch64) rootfs.

Then create a tarfile from the rootfs and pipe it into docker import.

$ sudo tar -C /media/linaro/thumb/stretch/ -cf ~/stretch.tar .
$ cat stretch.tar | sudo docker import - mystretchbase

Our Stretch Docker base image is called mystretchbase. It exists on our local machine along with the cached copy of the ubuntu image we loaded earlier from hub.docker.com:

$ sudo docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
mystretchbase     latest              2ce74caa6a46        17 hours ago        277.1 MB
aarch64/ubuntu      latest              08b9525bda5d        6 days ago          114.1 MB

We can launch it with the following command:

$ sudo docker run -it mystretchbase /bin/bash

Wrap Up

We installed the Docker package for Debian Jessie giving Docker functionality on an aarch64 board with only 1GB of RAM. If you have an Enterprise-class board with a decent amount of RAM there is a guide to compiling Docker from source found here

To try out your running container, why not install an Apache web server in it? By default, containers have an IP address and network access via a Docker networking bridge. Although containers are automatically assigned an IP address, inherent DNS for containers is not supported on Docker 1.9.1 - installed in this post - but will be available in 1.10. If you want DNS then you will have to add it either to your host - or of course it could be as another flavour of container - providing a DNS server. Once you’ve built any container you’re happy with, you can save the image for later use. You can also automate re-creating the image by recording the steps in a Dockerfile and using docker build.

© 著作权归作者所有

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

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

openthings
2016/12/08
140
0
华为最新开源开发板 HiKey960 发布 配置强悍

3月6日-10日,Linaro Connect BUD17大会火热进行中。本次大会上,华为携手合作伙伴诚迈科技即将推出的96Boards家族新成员HiKey960抢先亮相。 据了解,Hikey960是基于Kirin960 SoC的96Boards,...

局长
2017/03/09
3.7K
18
ARM64上Docker编译问题与解决

编译过程 在96Boards 的410C上编译Docker(这里使用Dokcer 1.14 Master版本,方法参考),遇到些问题,解决方法如下: 修改Docker源码目录下的Dockerfile.aarch64文件 修改 FROM aarch64/ubu...

openthings
2016/12/10
44
0
ARM 开放平台规范--96Boards

96Boards 是 ARM 开放平台规范,是第一个定义 Cortex-A 开发板的开放规范,Cortex-A 是 ARM SoC 供应商提供的低耗能,小脚本 32 位和 64 位开发板。标准化扩展 Peripheral I/O 总线,显示和相...

叶秀兰
2015/03/03
3.7K
1
DragonBoard 高通推出 IoT板 hitting raspberry pi

https://developer.qualcomm.com/hardware/dragonboard-410c

Jr小王子
2016/12/13
9
0

没有更多内容

加载失败,请刷新页面

加载更多

你为什么在Redis里读到了本应过期的数据

一个事故的故事 晚上睡的正香突然被电话吵醒,对面是开发焦急的声音:我们的程序在访问redis的时候读到了本应过期的key导致整个业务逻辑出了问题,需要马上解决。 看到这里你可能会想:这是不...

IT--小哥
今天
2
0
祝大家节日快乐,阖家幸福! centos GnuTLS 漏洞

yum update -y gnutls 修复了GnuTLS 漏洞。更新到最新 gnutls.x86_64 0:2.12.23-22.el6 版本

yizhichao
昨天
5
0
Scrapy 1.5.0之选择器

构造选择器 Scrapy选择器是通过文本(Text)或 TextResponse 对象构造的 Selector 类的实例。 它根据输入类型自动选择最佳的解析规则(XML vs HTML): >>> from scrapy.selector import Sele...

Eappo_Geng
昨天
4
0
Windows下Git多账号配置,同一电脑多个ssh-key的管理

Windows下Git多账号配置,同一电脑多个ssh-key的管理   这一篇文章是对上一篇文章《Git-TortoiseGit完整配置流程》的拓展,所以需要对上一篇文章有所了解,当然直接往下看也可以,其中也有...

morpheusWB
昨天
5
0
中秋快乐!!!

HiBlock
昨天
3
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部