Taillieu.Info

More Than a Hobby..

Docker Setup: Build & Publish app.

// Docker enable Hyper-V -> VirtualBox no longer work. VT-x is not available, but is enabled in BIOS

https://docs.docker.com/get-started/#setup


 

Containers vs. virtual machines

Consider this diagram comparing virtual machines to containers:

Virtual Machine diagram

Virtual machine stack example

Virtual machines run guest operating systems—note the OS layer in each box. This is resource intensive, and the resulting disk image and application state is an entanglement of OS settings, system-installed dependencies, OS security patches, and other easy-to-lose, hard-to-replicate ephemera.

Container diagram

Container stack example

Containers can share a single kernel, and the only information that needs to be in a container image is the executable and its package dependencies, which never need to be installed on the host system. These processes run like native processes, and you can manage them individually by running commands like docker ps—just like you would run ps on Linux to see active processes. Finally, because they contain all their dependencies, there is no configuration entanglement; a containerized app “runs anywhere.”


 

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\taillif>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
Status: Downloaded newer image for hello-world:latest

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.
(amd64)
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.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/


 C:\Users\taillif>docker --version
Docker version 17.09.1-ce, build 19e2cf6


 C:\Users\taillif>docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
660c48dd555d: Pull complete
4c7380416e78: Pull complete
421e436b5f80: Pull complete
e4ce6c3651b3: Pull complete
be588e74bd34: Pull complete
Digest: sha256:7c67a2206d3c04703e5c23518707bdd4916c057562dd51c74b99b2ba26af0f79
Status: Downloaded newer image for ubuntu:latest
root@0ac1f4af2153:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@0ac1f4af2153:/#


 https://docs.docker.com/docker-for-windows/#explore-the-application-and-run-examples

 

docker images

docker ps (List running containers)

docker inspect

       
Install Start Start Remove application Remove Image
 docker run -d -p 80:80 --name webserver nginx  docker start webserver  docker stop webserver  docker rm -f webserver  docker rmi nginx
https://docs.docker.com/get-started/part2/#dockerfile 
 

Build the app

 docker build -t friendlyhello
 

Run the app

 docker run -p 4000:80 friendlyhello

Share your image

 
 

Log in with your Docker ID

 docker login
 

Tag the image

 docker tag image username/repository:tag
 

Publish the image

 docker push username/repository:tag
https://cloud.docker.com/app/francistaillieu/repository/list  

docker volume create Docker

 Install OpenHAB:

docker run -it --name openhab --net=host openhab/openhab:2.1.0-amd64-debian
docker volume create Docker
 

C:\Users\taillif>docker run -it --name openhab --net=host openhab/openhab:2.1.0-amd64-debian
Unable to find image 'openhab/openhab:2.1.0-amd64-debian' locally
2.1.0-amd64-debian: Pulling from openhab/openhab
cc9214062dda: Pull complete
6343173f8aef: Pull complete
c44671cc2d42: Pull complete
dead6204a198: Pull complete
970c1882f6b0: Pull complete
848c77bf439a: Pull complete
b05e3cdadbbf: Pull complete
0474f0895911: Pull complete
Digest: sha256:04aced8b4e16246c590206148bcdba3747115474de1e3177f248bbd0d81472d4
Status: Downloaded newer image for openhab/openhab:2.1.0-amd64-debian
+ set -euo pipefail
+ IFS='
'
+ NEW_USER_ID=9001
+ NEW_GROUP_ID=9001
+ echo 'Starting with openhab user id: 9001 and group id: 9001'
Starting with openhab user id: 9001 and group id: 9001
+ id -u openhab
+ echo 'Create group openhab with id 9001'
Create group openhab with id 9001
+ groupadd -g 9001 openhab
+ echo 'Create user openhab with id 9001'
Create user openhab with id 9001
+ adduser -u 9001 --disabled-password --gecos '' --home /openhab --gid 9001 openhab
Warning: The home dir /openhab you specified already exists.
Adding user `openhab' ...
Adding new user `openhab' (9001) with group `openhab' ...
The home directory `/openhab' already exists. Not copying from `/etc/skel'.
adduser: Warning: The home directory `/openhab' does not belong to the user you are currently creating.
+ groupadd -g 14 uucp2
+ groupadd -g 16 dialout2
+ groupadd -g 18 dialout3
+ groupadd -g 32 uucp3
+ groupadd -g 997 gpio
+ adduser openhab dialout
Adding user `openhab' to group `dialout' ...
Adding user openhab to group dialout
Done.
+ adduser openhab uucp
Adding user `openhab' to group `uucp' ...
Adding user openhab to group uucp
Done.
+ adduser openhab uucp2
Adding user `openhab' to group `uucp2' ...
Adding user openhab to group uucp2
Done.
+ adduser openhab dialout2
Adding user `openhab' to group `dialout2' ...
Adding user openhab to group dialout2
Done.
+ adduser openhab dialout3
Adding user `openhab' to group `dialout3' ...
Adding user openhab to group dialout3
Done.
+ adduser openhab uucp3
Adding user `openhab' to group `uucp3' ...
Adding user openhab to group uucp3
Done.
+ adduser openhab gpio
Adding user `openhab' to group `gpio' ...
Adding user openhab to group gpio
Done.
+ case ${OPENHAB_VERSION} in
++ ls -A /openhab/userdata
+ '[' -z 'etc
logs
tmp' ']'
++ ls -A /openhab/conf
+ '[' -z 'html
icons
items
persistence
rules
scripts
services
sitemaps
sounds
things
transform' ']'
+ chown -R openhab:openhab /openhab
+ exec gosu openhab ./start.sh
Launching the openHAB runtime...

__ _____ ____
____ ____ ___ ____ / / / / | / __ )
/ __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
/ /_/ / /_/ / __/ / / / __ / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/
/_/ 2.1.0
- release build -

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab>