文档章节

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

openthings
 openthings
发布于 2016/12/09 08:13
字数 1181
阅读 185
收藏 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
粉丝 286
博文 1052
码字总数 574209
作品 1
东城
架构师
私信 提问
华为最新开源开发板 HiKey960 发布 配置强悍

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

局长
2017/03/09
4.2K
18
Snappy Ubuntu Core 登陆 Bubblegum-96 单板机

Canonical的April Wang今天非常荣幸的宣布面向嵌入式和物联网设备的Snappy Ubuntu Core操作系统正式登陆Bubblegum-96单板计算机(SBC)。Bubblegum-96单板机由uCRobotics设计,装备了时钟频率...

oschina
2016/08/05
1K
3
ARM64上的Docker编译与安装

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

openthings
2016/12/08
140
0
官宣:Linux 内核主要贡献者 Linaro「喜提」新任 CEO!

新旧之交,作为 Linux 内核等开源项目的主要贡献者之一,刚跨入 2019 年的 Linaro 也迎来了自己的新任 CEO。 1 月 3 日,Linaro 官方宣布接下来将由宫力接棒 George Grey 出任 CEO,带领团队...

CSDN资讯
01/05
0
0
面向物联网的几大开源操作系统

在过去的十年间,大多数新型开源操作系统已从移动市场转向物联网市场。本文介绍了面向物联网的许多新型开源操作系统。我们之前的文章介绍了开源物联网框架,以及面向物联网和消费者智能家居设...

红薯
2016/11/15
8.4K
6

没有更多内容

加载失败,请刷新页面

加载更多

听说拼多多因漏洞被薅了200亿?- 谈谈软件测试

昨天看到一个大新闻:拼多多在20日凌晨出现漏洞,用户可以领100元无门槛优惠券。一夜之间,被黑产、羊毛党和闻讯而来的吃瓜群众薅了个底朝天,直到第二天上午9点才将优惠券下架。网上传言这一...

crossin
30分钟前
2
0
微服务架构有毒,何时不使用微服务?

在过去的四年中,使用微服务来构建应用程序似乎成了一种标准。大多数我所合作过的团队也对此表现出了不同程度的兴趣。 微服务所承诺的弹性、高可用、低耦合、敏捷,以及能够解决单体架构带来...

架构师springboot
36分钟前
2
0
日志服务Python消费组实战(三):实时跨域监测多日志库数据

摘要: 本文主要介绍如何使用消费组实时监控多个域中的多个日志库中的异常数据,并进行下一步告警动作。具备配置简单、逻辑灵活、支持跨域多Region、实时监测,无需配置索引等特点,并且性能...

阿里云云栖社区
36分钟前
2
0
常用css动效

1.列表浮层变化动效 demo地址 下载地址 2.js动画库 github地址 3.滚动加载 Scrollreveal 4.其他动效 tobiasahlin

chinahufei
38分钟前
3
0
Coding and Paper Letter(四十六)

资源整理。 1 Coding: 1.卫星影像深度学习资源。 satellite image deep learning 2.runoff tools为MOM生成径流文件的一些工具变得轻而易举。 runoff tools 3.NOAA-GFDL海冰模拟器V2.0。 SIS2...

胖胖雕
40分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部