Difference between revisions of "IoTGateway/Docker"

From ESS-WIKI
Jump to: navigation, search
(Created page with "Category:Technique")
 
Line 1: Line 1:
 +
Use Docker to set up build environment more safely & quickly
 +
 +
==Overview==
 +
To deliver a clean build environment for customer development, we are used to provide a VMWare image. However, this kind of hypervisor mechanism is bigger and always comes worse performance. Fortunately, we have an alternative way for this now. We put the build environment into a container. In a container, performance for building process is similar as native computer, and it also provides process isolation & resource limitation for security and stability.
 +
 +
 +
We adopt [https://www.docker.com/ Docker] to achieve this feature.
 +
 +
==Requirement==
 +
Before you use Docker to develop, you have to install Docker on your platform. Please refer to [https://docs.docker.com/engine/installation/ Docker Installation Guide]. You are able to install Docker on Linux, Cloud, Windows, and OS X. In general, you may choose to install on ''Ubuntu''.<ref name="ref1" />
 +
 +
==Usage==
 +
===Get base image===
 +
It's easy to get the images we provided. You can use ''docker pull <IMAGE REPOSITORY>'' to get the images in the [[#Image List | image list]].
 +
 +
$ docker pull advrisc/u12.04
 +
 +
Using default tag: latest
 +
latest: Pulling from advrisc/u12.04
 +
f371838f5dfc: Pull complete
 +
ba07dd60c647: Pull complete
 +
5880097ae715: Pull complete
 +
f4661df611e4: Pull complete
 +
54a5be518f6c: Pull complete
 +
e2bec7aca208: Pull complete
 +
2329df4bbef8: Pull complete
 +
8c316cbbf1ac: Pull complete
 +
759306f82120: Pull complete
 +
129b531714c2: Pull complete
 +
9785b9285b43: Pull complete
 +
4edbf4b599cd: Pull complete
 +
6662a831b325: Pull complete
 +
69b5c4a73004: Pull complete
 +
2356632c3d7c: Pull complete
 +
7de0ecf5853e: Pull complete
 +
437e96edde13: Pull complete
 +
71b22a0603c5: Pull complete
 +
81f2b54bc89e: Pull complete
 +
45223227ca23: Pull complete
 +
e088fe2feb22: Pull complete
 +
Digest: sha256:10f22a1cfbb657b8db267860773078fc09118604b421d47e260dac7c4fa04099
 +
Status: Image is up to date for advrisc/u12.04:latest
 +
 +
You can check the image stored locally by ''docker images''.
 +
$ docker images
 +
REPOSITORY                              TAG                IMAGE ID            CREATED            VIRTUAL SIZE
 +
advrisc/u12.04                          latest              e088fe2feb22        59 minutes ago      1.438 GB
 +
 +
===Create a container===
 +
You can run a container with a prompt by ''docker run''. If you do not pull Docker base image first, it will try to download from the DockerHub repository.
 +
 +
$ docker run -it advrisc/u12.04 /bin/bash
 +
 +
adv@d0ab7f662fb3:~$
 +
 +
To leave a container, type ''exit'' to stop it or use ''Ctrl + P + Q'' to detach the container.
 +
adv@d0ab7f662fb3:~$ exit
 +
exit
 +
 +
You can check the container status by ''docker ps''.
 +
$ docker ps -a
 +
CONTAINER ID        IMAGE                COMMAND            CREATED            STATUS                    PORTS          NAMES
 +
d0ab7f662fb3        advrisc/u12.04      "/bin/bash"        3 minutes ago      Exited (0) 4 seconds ago                  clever_bartik
 +
 +
To enter the container again, you need to do ''docker start <CONTAINER ID>'' & ''docker attach <CONTAINER ID>''.
 +
$ docker start d0ab7f662fb3
 +
d0ab7f662fb3
 +
 +
$ docker attach d0ab7f662fb3
 +
adv@d0ab7f662fb3:~$
 +
 +
===Share data with host===
 +
 +
===BSP building===
 +
 +
===Copy data to host===
 +
 +
===Remove container===
 +
 +
==Image List==
 +
All our images are stored in [https://hub.docker.com/explore/ DockerHub]. You can explore and find the image as listed below.
 +
{| class="wikitable" style="text-align: center; width: 600px;"
 +
! Image Repository
 +
! Image Tag
 +
! Base OS
 +
! Supported Platforms
 +
|-
 +
| [https://hub.docker.com/r/advrisc/u12.04/ advrisc/u12.04]
 +
| latest
 +
| Ubuntu 12.04
 +
| Freescale i.MX6 Yocto 1.5
 +
|}
 +
 +
==References==
 +
<references>
 +
<ref name="ref1">[https://docs.docker.com/engine/installation/linux/ubuntulinux/ Docker Installation on Ubuntu]</ref>
 +
</references>
 +
 +
 
[[Category:Technique]]
 
[[Category:Technique]]

Revision as of 08:32, 25 February 2016

Use Docker to set up build environment more safely & quickly

Overview

To deliver a clean build environment for customer development, we are used to provide a VMWare image. However, this kind of hypervisor mechanism is bigger and always comes worse performance. Fortunately, we have an alternative way for this now. We put the build environment into a container. In a container, performance for building process is similar as native computer, and it also provides process isolation & resource limitation for security and stability.


We adopt Docker to achieve this feature.

Requirement

Before you use Docker to develop, you have to install Docker on your platform. Please refer to Docker Installation Guide. You are able to install Docker on Linux, Cloud, Windows, and OS X. In general, you may choose to install on Ubuntu.[1]

Usage

Get base image

It's easy to get the images we provided. You can use docker pull <IMAGE REPOSITORY> to get the images in the image list.

$ docker pull advrisc/u12.04

Using default tag: latest
latest: Pulling from advrisc/u12.04
f371838f5dfc: Pull complete
ba07dd60c647: Pull complete
5880097ae715: Pull complete
f4661df611e4: Pull complete
54a5be518f6c: Pull complete
e2bec7aca208: Pull complete
2329df4bbef8: Pull complete
8c316cbbf1ac: Pull complete
759306f82120: Pull complete
129b531714c2: Pull complete
9785b9285b43: Pull complete
4edbf4b599cd: Pull complete
6662a831b325: Pull complete
69b5c4a73004: Pull complete
2356632c3d7c: Pull complete
7de0ecf5853e: Pull complete
437e96edde13: Pull complete
71b22a0603c5: Pull complete
81f2b54bc89e: Pull complete
45223227ca23: Pull complete
e088fe2feb22: Pull complete
Digest: sha256:10f22a1cfbb657b8db267860773078fc09118604b421d47e260dac7c4fa04099
Status: Image is up to date for advrisc/u12.04:latest

You can check the image stored locally by docker images.

$ docker images
REPOSITORY                               TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
advrisc/u12.04                           latest              e088fe2feb22        59 minutes ago      1.438 GB

Create a container

You can run a container with a prompt by docker run. If you do not pull Docker base image first, it will try to download from the DockerHub repository.

$ docker run -it advrisc/u12.04 /bin/bash

adv@d0ab7f662fb3:~$

To leave a container, type exit to stop it or use Ctrl + P + Q to detach the container.

adv@d0ab7f662fb3:~$ exit
exit

You can check the container status by docker ps.

$ docker ps -a
CONTAINER ID        IMAGE                COMMAND             CREATED             STATUS                     PORTS           NAMES
d0ab7f662fb3        advrisc/u12.04       "/bin/bash"         3 minutes ago       Exited (0) 4 seconds ago                   clever_bartik

To enter the container again, you need to do docker start <CONTAINER ID> & docker attach <CONTAINER ID>.

$ docker start d0ab7f662fb3
d0ab7f662fb3

$ docker attach d0ab7f662fb3
adv@d0ab7f662fb3:~$

Share data with host

BSP building

Copy data to host

Remove container

Image List

All our images are stored in DockerHub. You can explore and find the image as listed below.

Image Repository Image Tag Base OS Supported Platforms
advrisc/u12.04 latest Ubuntu 12.04 Freescale i.MX6 Yocto 1.5

References

  1. Docker Installation on Ubuntu