Docker Guide: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 43: Line 43:


* Check docker version.<br>
* Check docker version.<br>
root@imx8mm-var-dart:~# docker --version<br>
  root@imx8mm-var-dart:~# docker --version<br>
Docker version 18.09.3-ce, build f5e591e
  Docker version 18.09.3-ce, build f5e591e


== Test hello-world ==
== Test hello-world ==
  root@imx8mm-var-dart:~# docker pull hello-world<br>
root@imx8mm-var-dart:~# docker pull hello-world<br>
  Using default tag: latest<br>
Using default tag: latest<br>
  latest: Pulling from library/hello-world<br>
latest: Pulling from library/hello-world<br>
  256ab8fe8778: Pull complete <br>
256ab8fe8778: Pull complete <br>
  Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e<br>
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e<br>
  Status: Downloaded newer image for hello-world:latest
Status: Downloaded newer image for hello-world:latest


* List docker images:<br>
* List docker images:<br>
  root@imx8mm-var-dart:~# docker images<br>
  root@imx8mm-var-dart:~# docker images<br>
  REPOSITORY          TAG                IMAGE ID            CREATED            SIZE<br>
  REPOSITORY          TAG                IMAGE ID            CREATED            SIZE<br>
  hello-world        latest              a29f45ccde2a        3 months ago        9.14kB
  hello-world        latest              a29f45ccde2a        3 months ago        9.14kB


* Run hello-world:<br>
* Run hello-world:<br>
  root@imx8mm-var-dart:~# docker run hello-world
  root@imx8mm-var-dart:~# docker run hello-world


  Hello from Docker!<br>
  Hello from Docker!<br>
  This message shows that your installation appears to be working correctly.
  This message shows that your installation appears to be working correctly.


  To generate this message, Docker took the following steps:<br>
  To generate this message, Docker took the following steps:<br>
    1. The Docker client contacted the Docker daemon.<br>
  1. The Docker client contacted the Docker daemon.<br>
    2. The Docker daemon pulled the "hello-world" image from the Docker Hub.<br>
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.<br>
      (arm64v8)<br>
      (arm64v8)<br>
    3. The Docker daemon created a new container from that image which runs the<br>
  3. The Docker daemon created a new container from that image which runs the<br>
      executable that produces the output you are currently reading.<br>
      executable that produces the output you are currently reading.<br>
    4. The Docker daemon streamed that output to the Docker client, which sent it<br>
  4. The Docker daemon streamed that output to the Docker client, which sent it<br>
      to your terminal.
      to your terminal.


== Test ubuntu ==
== Test ubuntu ==
  root@imx8mm-var-dart:~# docker pull ubuntu
root@imx8mm-var-dart:~# docker pull ubuntu
  Using default tag: latest
Using default tag: latest
  latest: Pulling from library/ubuntu
latest: Pulling from library/ubuntu
  b2f61026a351: Pull complete  
b2f61026a351: Pull complete  
  5538fb30c42c: Pull complete  
5538fb30c42c: Pull complete  
  f0b05810781a: Pull complete  
f0b05810781a: Pull complete  
  0180a33352d6: Pull complete  
0180a33352d6: Pull complete  
  Digest: sha256:bec5a2727be7fff3d308193cfde3491f8fba1a2ba392b7546b43a051853a341d
Digest: sha256:bec5a2727be7fff3d308193cfde3491f8fba1a2ba392b7546b43a051853a341d
  Status: Downloaded newer image for ubuntu:latest
Status: Downloaded newer image for ubuntu:latest


* List docker images:<br>
* List docker images:<br>
  root@imx8mm-var-dart:~# root@imx8mm-var-dart:~# docker images
  root@imx8mm-var-dart:~# root@imx8mm-var-dart:~# docker images
  REPOSITORY          TAG                IMAGE ID            CREATED            SIZE
  REPOSITORY          TAG                IMAGE ID            CREATED            SIZE
  ubuntu              latest              428b2f74b0fb        2 weeks ago        57.7MB
  ubuntu              latest              428b2f74b0fb        2 weeks ago        57.7MB
  hello-world        latest              a29f45ccde2a        3 months ago        9.14kB
  hello-world        latest              a29f45ccde2a        3 months ago        9.14kB


* Run ubuntu:<br>
* Run ubuntu:<br>
  root@imx8mm-var-dart:~# docker run -it ubuntu<br>
  root@imx8mm-var-dart:~# docker run -it ubuntu<br>
  root@8637148015f5:/# apt update<br>
  root@8637148015f5:/# apt update<br>
  .................................<br>
  .................................<br>
  Fetched 16.3 MB in 11s (1471 kB/s)<br>                                                                                                               
  Fetched 16.3 MB in 11s (1471 kB/s)<br>                                                                                                               
  Reading package lists... Done<br>
  Reading package lists... Done<br>
  Building dependency tree<br>
  Building dependency tree<br>
  Reading state information... Done<br>
  Reading state information... Done<br>
  12 packages can be upgraded. Run 'apt list --upgradable' to see them.
  12 packages can be upgraded. Run 'apt list --upgradable' to see them.


  root@8637148015f5:/# apt install nodejs<br>
  root@8637148015f5:/# apt install nodejs<br>
  Reading package lists... Done<br>
  Reading package lists... Done<br>
  Building dependency tree<br>
  Building dependency tree<br>
  Reading state information... Done<br>
  Reading state information... Done<br>
  The following additional packages will be installed:<br>
  The following additional packages will be installed:<br>
    ca-certificates libc-ares2 libhttp-parser2.7.1 libicu60 libnghttp2-14 libssl1.0.0 libssl1.1 libuv1 nodejs-doc openssl<br>
    ca-certificates libc-ares2 libhttp-parser2.7.1 libicu60 libnghttp2-14 libssl1.0.0 libssl1.1 libuv1 nodejs-doc openssl<br>
  The following NEW packages will be installed:<br>
  The following NEW packages will be installed:<br>
    ca-certificates libc-ares2 libhttp-parser2.7.1 libicu60 libnghttp2-14 libssl1.0.0 libssl1.1 libuv1 nodejs nodejs-doc openssl<br>
    ca-certificates libc-ares2 libhttp-parser2.7.1 libicu60 libnghttp2-14 libssl1.0.0 libssl1.1 libuv1 nodejs nodejs-doc openssl<br>
  0 upgraded, 11 newly installed, 0 to remove and 12 not upgraded.<br>
  0 upgraded, 11 newly installed, 0 to remove and 12 not upgraded.<br>
  Need to get 15.6 MB of archives.<br>
  Need to get 15.6 MB of archives.<br>
  After this operation, 62.8 MB of additional disk space will be used.<br>
  After this operation, 62.8 MB of additional disk space will be used.<br>
  Do you want to continue? [Y/n] y<br>
  Do you want to continue? [Y/n] y<br>
  ...........................................<br>
  ...........................................<br>
  Updating certificates in /etc/ssl/certs...<br>
  Updating certificates in /etc/ssl/certs...<br>
  0 added, 0 removed; done.<br>
  0 added, 0 removed; done.<br>
  Running hooks in /etc/ca-certificates/update.d...<br>
  Running hooks in /etc/ca-certificates/update.d...<br>
  done.<br>
  done.<br>


  root@8637148015f5:/# node -v<br>
  root@8637148015f5:/# node -v<br>
  v8.10.0<br>
  v8.10.0<br>
  root@8637148015f5:/# exit<br>
  root@8637148015f5:/# exit<br>


= Test docker-compose =
= Test docker-compose =

Revision as of 17:01, 10 April 2020

Docker Introduction

<https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-9>

Docker is an application that simplifies the process of managing application processes in containers.
Containers let you run your applications in resource-isolated processes. They’re similar to virtual machines, but containers
are more portable, more resource-friendly, and more dependent on the host operating system.

For a detailed introduction to the different components of a Docker container, check out The Docker Ecosystem: An Introduction to
Common Components.

You can check SWUpdate's online documentation at: http://sbabic.github.io/swupdate
This Introduction was taken from the SWUpdate README.md at: https://github.com/sbabic/swupdate

Yocto Integration

Recipes

Before you begin, get familiar with the Varicite Yocto Build Release guide.

Variscite provides the following image recipes:

  • var-image-docker - Based on fsl-image-core with the following differences:
    • xxxxxxxxxxxxxx


Create a Docker-ready Image

$ cd 
$ MACHINE= DISTRO=
$ bitbake var-image-docker (for the rootfs to be installed on the eMMC)

Test Docker

  • Check target internet connection
 root@imx8mm-var-dart:~# ping www.google.com
  • Get target ip address.
  • Open ssh terminal from host:
 ssh root@<ip address>
  • Check docker version.
 root@imx8mm-var-dart:~# docker --version
Docker version 18.09.3-ce, build f5e591e

Test hello-world

root@imx8mm-var-dart:~# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
256ab8fe8778: Pull complete
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
Status: Downloaded newer image for hello-world:latest

  • List docker images:
 root@imx8mm-var-dart:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest a29f45ccde2a 3 months ago 9.14kB
  • Run hello-world:
 root@imx8mm-var-dart:~# docker run hello-world
 Hello from Docker!
This message shows that your installation appears to be working correctly.
 To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

Test ubuntu

root@imx8mm-var-dart:~# docker pull ubuntu Using default tag: latest latest: Pulling from library/ubuntu b2f61026a351: Pull complete 5538fb30c42c: Pull complete f0b05810781a: Pull complete 0180a33352d6: Pull complete Digest: sha256:bec5a2727be7fff3d308193cfde3491f8fba1a2ba392b7546b43a051853a341d Status: Downloaded newer image for ubuntu:latest

  • List docker images:
 root@imx8mm-var-dart:~# root@imx8mm-var-dart:~# docker images
 REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
 ubuntu              latest              428b2f74b0fb        2 weeks ago         57.7MB
 hello-world         latest              a29f45ccde2a        3 months ago        9.14kB
  • Run ubuntu:
 root@imx8mm-var-dart:~# docker run -it ubuntu
root@8637148015f5:/# apt update
.................................
Fetched 16.3 MB in 11s (1471 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
12 packages can be upgraded. Run 'apt list --upgradable' to see them.
 root@8637148015f5:/# apt install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates libc-ares2 libhttp-parser2.7.1 libicu60 libnghttp2-14 libssl1.0.0 libssl1.1 libuv1 nodejs-doc openssl
The following NEW packages will be installed:
ca-certificates libc-ares2 libhttp-parser2.7.1 libicu60 libnghttp2-14 libssl1.0.0 libssl1.1 libuv1 nodejs nodejs-doc openssl
0 upgraded, 11 newly installed, 0 to remove and 12 not upgraded.
Need to get 15.6 MB of archives.
After this operation, 62.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
...........................................
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
 root@8637148015f5:/# node -v
v8.10.0
root@8637148015f5:/# exit

Test docker-compose

  • Check docker-compose version.
 root@imx8mm-var-dart:~# docker-compose --version
docker-compose version 1.21.2, build e7de1bc
root@imx8mm-var-dart:~#