SlideShare a Scribd company logo
1 of 38
Download to read offline
Develop QNAP NAS App
by Docker
Terry Chen 陳彥村
Engineer @ QNAP
Who am I?
https://tw.linkedin.com/in/seterrychen
https://github.com/seterrychen
https://twitter.com/seterrychen
● Backend engineer : Java, Python, Linux
● QNAP Container Station/Linux Station
Outline
● How to develop QNAP NAS App
● Base knowledge of Docker
● Create Docker App on QNAP NAS in QPKG format
NAS - Network attached storage
From : http://www.slideshare.net/QNAP_Inc/general-tech-trainingstorageabcqnap20140302compressed-copy
Network
QNAP AppCenter
● Customize your QNAP NAS with Apps
QPKG
● QNAP package, like deb(Debian/Ubuntu),
rpm(Red Hat/CentOS)
● QNAP tool-chain:
https://sourceforge.net/projects/qosgpl/files/QNAP%20NAS%20Tool%20Chains/
● QPKG format:
[/share/CACHEDEV3_DATA/.qpkg/QDK/tester] # ls
arm-x09/ arm-x31/ config/ package_routines shared/
x86_64/ arm-x19/ arm-x41/ icons/
qpkg.cfg x86/ x86_ce53xx/
Package application by QDK/QDK2
● QDK
http://www.qnap.com.tw/event/dev/cht/p_qdk.php
● QDK2
https://github.com/qnap-dev/qdk2
● QDK2 with Docker
https://github.com/fcwu/docker-qdk2
QDK
http://download.qnap.com/dev/QDK_Quick_Start_Guide_v4_eng.pdf
QDK2
● https://github.com/qnap-dev/qdk2
● Debian/Ubuntu base tool
● Support various source
Docker review
What is Docker?
● Docker allows you to package an application
with all of its dependencies into a standardized
unit for software development.
Others
App
image
Images center - Docker Hub
How to ship application by Docker
892607a8d00b 0 B
0b10aa9d5e8a 0 B
f4e6d72dbf27 22 B
9c6eed7ce0e9 57.66 MB
2eda4505e518 0 B
2a6ec6bae792 0 B
32f2a4cccab8 0 B
70e9a6907f10 125.1 MB
nginx:1.10
Image
Layer
$ docker pull nginx:1.10
Docker storage (version: 1.9.1)
vagrant@test:~$ sudo docker info
Containers: 0
Images: 2
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
………
892607a8d00b 0 B
0b10aa9d5e8a 0 B
f4e6d72dbf27 22 B
9c6eed7ce0e9 57.66 MB
2eda4505e518 0 B
2a6ec6bae792 0 B
32f2a4cccab8 0 B
70e9a6907f10 125.1 MB
Nginx:1.10
vagrant@test:~$ sudo ls -l /var/lib/docker/aufs/diff
total 32
drwxr-xr-x 2 root root 4096 May 1 07:40 0b10aa9d5e8a3dd8de176539bd...
drwxr-xr-x 2 root root 4096 May 1 07:39 2a6ec6bae79235ea27adcceff6...
drwxr-xr-x 2 root root 4096 May 1 07:39 2eda4505e518d08147e4fab915...
drwxr-xr-x 2 root root 4096 May 1 07:15 32f2a4cccab87ff519e17c9cf4...
drwxr-xr-x 21 root root 4096 May 1 07:15 70e9a6907f1068b3e08a9e6357...
drwxr-xr-x 2 root root 4096 May 1 07:40 892607a8d00ba2ad196a7d8a43...
drwxr-xr-x 7 root root 4096 May 1 07:40 9c6eed7ce0e9c7f8ab8e95d2f7...
drwxr-xr-x 3 root root 4096 May 1 07:40 f4e6d72dbf272d7e2ba0ef48f7...
Docker storage (version: 1.9.1)
vagrant@test:~$ sudo docker info
Containers: 0
Images: 2
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
………
892607a8d00b 0 B
0b10aa9d5e8a 0 B
f4e6d72dbf27 22 B
9c6eed7ce0e9 57.66 MB
2eda4505e518 0 B
2a6ec6bae792 0 B
32f2a4cccab8 0 B
70e9a6907f10 125.1 MB
Nginx:1.10
root@test:/var/lib/docker/aufs/diff/70e9a6907f1068b3e08a9e...# ls
bin boot dev etc home lib lib64 media mnt opt
proc root run sbin srv sys tmp usr var
root@test:/var/lib/docker/aufs/diff/9c6eed7ce0e9c7f8ab8e95...# ls
etc lib tmp usr var
AUFS – Another Union File System
From : https://docs.docker.com/engine/userguide/storagedriver/aufs-driver/
Run container (version: 1.9.1)
$ docker run -d -p 80:80 nginx:1.10
Docker
Client
Docker
Daemon
Send Request
892607a8d00b 0 B
0b10aa9d5e8a 0 B
f4e6d72dbf27 22 B
9c6eed7ce0e9 57.66 MB
2eda4505e518 0 B
2a6ec6bae792 0 B
32f2a4cccab8 0 B
70e9a6907f10 125.1 MB
Read/Writer Container Layer
Nginx:1.10
Send Response
Image read only
Simplified diagram
copy-on-write strategy
892607a8d00b 0 B
0b10aa9d5e8a 0 B
f4e6d72dbf27 22 B
9c6eed7ce0e9 57.66 MB
2eda4505e518 0 B
2a6ec6bae792 0 B
32f2a4cccab8 0 B
70e9a6907f10 125.1 MB
Read/Writer
Image read only
Nginx:1.10
Read/Writer
Read/Writer
Container-1
Container-2
Container-3
Basic isolation of Linux
● chroot – change root directory
root@test:/var/lib/docker/aufs/diff/70e9a6907f1068b3e08a9e...# ls
bin boot dev etc home lib lib64 media mnt opt
proc root run sbin srv sys tmp usr var
root@test:/var/lib/docker/aufs/diff/70e9a6907f1068b3e08a9e...# chroot .
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
root@test:/# ls -al
bin boot dev etc home lib lib64 media mnt opt
proc root run sbin srv sys tmp usr var
root@test:/# ls -al ../
bin boot dev etc home lib lib64 media mnt opt
proc root run sbin srv sys tmp usr var
Basic isolation of Linux
● chroot – change root directory
Filesystem Isolation
root@test:/# mount -t proc proc /proc
vagrant@test:~$ ps -ef
root 2192 906 0 02:54 ? 00:00:00 docker-proxy -proto ...
root 2215 906 0 02:54 ? 00:00:00 docker-proxy -proto ...
......
vagrant 2275 1915 0 03:03 pts/5 00:00:00 ps -ef
# using chroot
root@test:/# ps -ef
root 2192 906 0 02:54 ? 00:00:00 docker-proxy -proto ...
root 2215 906 0 02:54 ? 00:00:00 docker-proxy -proto ...
......
root 2277 2269 0 03:03 ? 00:00:00 ps -ef
How to isolate by Docker
● Linux Kernel feature:
– Cgroups
– Namespaces
● Mount namespaces
● UTS namespaces
● IPC namespaces
● PID namespaces
● Network namespaces
● User namespaces
Process namespace
From : http://dockone.io/article/783
Stop container
From : http://dockone.io/article/783 From:
https://twitter.com/turnoff_us/status/710736561676132352/photo/1
Docker on Linux
From : https://en.wikipedia.org/wiki/Docker_(software)
libcontainer
libvirt
systemd-
nspawnLXC
cgroups namespaces
SELinux
AppArmor
Netfilter
Netlink
capabilities
Docker
Linux kernel
VM vs Container
From : https://www.docker.com/what-docker
The power of Docker
From:https://yq.aliyun.com/articles/32071
Back to docker-qdk2
https://github.com/fcwu/docker-qdk2
Dockerize App by Dockerfile
From : https://github.com/nginxinc/docker-nginx/blob/41aa13f7d2c24407e483c40fb1e8b33e73462ff1/mainline/jessie/Dockerfile
Build and Ship
● Build
– docker build -t your_account/app_name .
● Ship
– docker login --username=yourname
--email=youremail@company.com
– docker push your_account/app_name
Start/Stop script
#!/bin/sh
...
case "$1" in
start)
ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
if [ "$ENABLED" != "TRUE" ]; then
echo "$QPKG_NAME is disabled."
exit 1
fi
: ADD START ACTIONS HERE
;;
stop)
: ADD STOP ACTIONS HERE
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
Example: ghost
● Just a blogging platform https://ghost.org
Build qpkg
$ git clone https://github.com/fcwu/docker-qdk2.git
$ cd docker-qdk2
$ docker run -it --rm 
-v ${PWD}/example:/example 
dorowu/qdk2 bash -c "cd /example; make"
$ ls -l example/ghost/build/ghost_0.7.4_x86_64.qpkg
-rw-r--r-- 1 u u 24242 Dec 30 13:10 example/ghost/build/ghost_0.7.4_x86_64.qpkg
Container Station API
● Version 1.6
- qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "install"}'
- qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "start"}'
- qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "stop"}'
- qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "remove"}'
docker-compose
● docker-compose.yml of Online-document
app:
image: dorowu/online-document.amd64:0.8.111
ports:
- "127.0.0.1:10001:5000"
volumes:
- /share:/share
- /mnt/rf/cd:/mnt/rf/cd
- /var/run/qbus.sock:/var/run/qbus.sock
● Read more: https://docs.docker.com/compose/
Apache config
● online-document.conf
ProxyPass /online-document/ws ws://127.0.0.1:10001/online-document/ws retry=0
ProxyPass /online-document/ http://127.0.0.1:10001/online-document/ retry=0
Create Issues/Pull Request
● https://github.com/fcwu/docker-qdk2
● https://github.com/qnap-dev/container-station-api
How to debug (In my case)
From : http://9gag.com/gag/anYZ9Eo/my-code-works-but-i-don-t-know-why
How to Learn (In my case)
“Try to learn something about everything and
everything about something.”
Thomas Huxley Quotes
Read more : 陈天:如何快速掌握一门技术? (http://blog.jobbole.com/77712/)
Thank you

More Related Content

What's hot

AWS Black Belt Online Seminar AWS CloudFormation アップデート
AWS Black Belt Online Seminar AWS CloudFormation アップデートAWS Black Belt Online Seminar AWS CloudFormation アップデート
AWS Black Belt Online Seminar AWS CloudFormation アップデートAmazon Web Services Japan
 
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか? [SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか? de:code 2017
 
DockerとPodmanの比較
DockerとPodmanの比較DockerとPodmanの比較
DockerとPodmanの比較Akihiro Suda
 
Re: ゼロから始める監視設計
Re: ゼロから始める監視設計Re: ゼロから始める監視設計
Re: ゼロから始める監視設計Masahito Zembutsu
 
AWS Direct Connect フェイルオーバーテストやってみた
AWS Direct Connect フェイルオーバーテストやってみたAWS Direct Connect フェイルオーバーテストやってみた
AWS Direct Connect フェイルオーバーテストやってみたSho Takahashi
 
Amazon EKS によるスマホゲームのバックエンド運用事例
Amazon EKS によるスマホゲームのバックエンド運用事例Amazon EKS によるスマホゲームのバックエンド運用事例
Amazon EKS によるスマホゲームのバックエンド運用事例gree_tech
 
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Adin Ermie
 
Azure DevOpsとセキュリティ
Azure DevOpsとセキュリティAzure DevOpsとセキュリティ
Azure DevOpsとセキュリティKazushi Kamegawa
 
[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld
[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld
[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason DonenfeldCODE BLUE
 
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)NTT DATA Technology & Innovation
 
Keycloakの実際・翻訳プロジェクト紹介
Keycloakの実際・翻訳プロジェクト紹介Keycloakの実際・翻訳プロジェクト紹介
Keycloakの実際・翻訳プロジェクト紹介Hiroyuki Wada
 
Azure Kubernetes Service Overview
Azure Kubernetes Service OverviewAzure Kubernetes Service Overview
Azure Kubernetes Service OverviewTakeshi Fukuhara
 
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)NTT DATA Technology & Innovation
 
高速にコンテナを起動できるイメージフォーマット
高速にコンテナを起動できるイメージフォーマット高速にコンテナを起動できるイメージフォーマット
高速にコンテナを起動できるイメージフォーマットAkihiro Suda
 
Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성 Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성 rockplace
 
Azure 仮想マシンにおける運用管理・高可用性設計のベストプラクティス
Azure 仮想マシンにおける運用管理・高可用性設計のベストプラクティスAzure 仮想マシンにおける運用管理・高可用性設計のベストプラクティス
Azure 仮想マシンにおける運用管理・高可用性設計のベストプラクティスYusuke Oi
 
Keycloak拡張入門
Keycloak拡張入門Keycloak拡張入門
Keycloak拡張入門Hiroyuki Wada
 
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-RegionJi-Woong Choi
 
Active Directory をInternetから使用するための4つのシナリオ
Active Directory をInternetから使用するための4つのシナリオActive Directory をInternetから使用するための4つのシナリオ
Active Directory をInternetから使用するための4つのシナリオjunichi anno
 
一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座
一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座
一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座Minoru Naito
 

What's hot (20)

AWS Black Belt Online Seminar AWS CloudFormation アップデート
AWS Black Belt Online Seminar AWS CloudFormation アップデートAWS Black Belt Online Seminar AWS CloudFormation アップデート
AWS Black Belt Online Seminar AWS CloudFormation アップデート
 
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか? [SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
[SC03] Active Directory の DR 対策~天災/人災/サイバー攻撃、その時あなたの IT 基盤は利用継続できますか?
 
DockerとPodmanの比較
DockerとPodmanの比較DockerとPodmanの比較
DockerとPodmanの比較
 
Re: ゼロから始める監視設計
Re: ゼロから始める監視設計Re: ゼロから始める監視設計
Re: ゼロから始める監視設計
 
AWS Direct Connect フェイルオーバーテストやってみた
AWS Direct Connect フェイルオーバーテストやってみたAWS Direct Connect フェイルオーバーテストやってみた
AWS Direct Connect フェイルオーバーテストやってみた
 
Amazon EKS によるスマホゲームのバックエンド運用事例
Amazon EKS によるスマホゲームのバックエンド運用事例Amazon EKS によるスマホゲームのバックエンド運用事例
Amazon EKS によるスマホゲームのバックエンド運用事例
 
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
Infrastructure-as-Code (IaC) Using Terraform (Intermediate Edition)
 
Azure DevOpsとセキュリティ
Azure DevOpsとセキュリティAzure DevOpsとセキュリティ
Azure DevOpsとセキュリティ
 
[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld
[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld
[CB16] WireGuard:次世代耐乱用性カーネルネットワークトンネル by Jason Donenfeld
 
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
コンテナセキュリティにおける権限制御(OCHaCafe5 #3 Kubernetes のセキュリティ 発表資料)
 
Keycloakの実際・翻訳プロジェクト紹介
Keycloakの実際・翻訳プロジェクト紹介Keycloakの実際・翻訳プロジェクト紹介
Keycloakの実際・翻訳プロジェクト紹介
 
Azure Kubernetes Service Overview
Azure Kubernetes Service OverviewAzure Kubernetes Service Overview
Azure Kubernetes Service Overview
 
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
コンテナとimmutableとわたし。あとセキュリティ。(Kubernetes Novice Tokyo #15 発表資料)
 
高速にコンテナを起動できるイメージフォーマット
高速にコンテナを起動できるイメージフォーマット高速にコンテナを起動できるイメージフォーマット
高速にコンテナを起動できるイメージフォーマット
 
Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성 Jenkins를 활용한 Openshift CI/CD 구성
Jenkins를 활용한 Openshift CI/CD 구성
 
Azure 仮想マシンにおける運用管理・高可用性設計のベストプラクティス
Azure 仮想マシンにおける運用管理・高可用性設計のベストプラクティスAzure 仮想マシンにおける運用管理・高可用性設計のベストプラクティス
Azure 仮想マシンにおける運用管理・高可用性設計のベストプラクティス
 
Keycloak拡張入門
Keycloak拡張入門Keycloak拡張入門
Keycloak拡張入門
 
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
 
Active Directory をInternetから使用するための4つのシナリオ
Active Directory をInternetから使用するための4つのシナリオActive Directory をInternetから使用するための4つのシナリオ
Active Directory をInternetから使用するための4つのシナリオ
 
一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座
一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座
一歩先行く Azure Computing シリーズ(全3回) 第2回 Azure VM どれを選ぶの? Azure VM 集中講座
 

Viewers also liked

Using docker to develop NAS applications
Using docker to develop NAS applicationsUsing docker to develop NAS applications
Using docker to develop NAS applicationsTerry Chen
 
QNAP COSCUP Container Station
QNAP COSCUP Container StationQNAP COSCUP Container Station
QNAP COSCUP Container StationWu Fan-Cheng
 
QNAP MOPCON 2015 - 輕鬆打造持續整合開發環境,使用 QNAP Docker
QNAP MOPCON 2015 -  輕鬆打造持續整合開發環境,使用 QNAP DockerQNAP MOPCON 2015 -  輕鬆打造持續整合開發環境,使用 QNAP Docker
QNAP MOPCON 2015 - 輕鬆打造持續整合開發環境,使用 QNAP DockerWu Fan-Cheng
 
Moment Co-efficient Method
Moment Co-efficient MethodMoment Co-efficient Method
Moment Co-efficient MethodYousuf Bin Aziz
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Arun prasath
 
Lessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In ProductionLessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In ProductionShingo Omura
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with dockerRuoshi Ling
 

Viewers also liked (7)

Using docker to develop NAS applications
Using docker to develop NAS applicationsUsing docker to develop NAS applications
Using docker to develop NAS applications
 
QNAP COSCUP Container Station
QNAP COSCUP Container StationQNAP COSCUP Container Station
QNAP COSCUP Container Station
 
QNAP MOPCON 2015 - 輕鬆打造持續整合開發環境,使用 QNAP Docker
QNAP MOPCON 2015 -  輕鬆打造持續整合開發環境,使用 QNAP DockerQNAP MOPCON 2015 -  輕鬆打造持續整合開發環境,使用 QNAP Docker
QNAP MOPCON 2015 - 輕鬆打造持續整合開發環境,使用 QNAP Docker
 
Moment Co-efficient Method
Moment Co-efficient MethodMoment Co-efficient Method
Moment Co-efficient Method
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
Lessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In ProductionLessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In Production
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with docker
 

Similar to Develop QNAP NAS App by Docker

Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Praguetomasbart
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Ricardo Amaro
 
Why you’re going to fail running java on docker!
Why you’re going to fail running java on docker!Why you’re going to fail running java on docker!
Why you’re going to fail running java on docker!Red Hat Developers
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xrkr10
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Novaclayton_oneill
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in descriptionPrzemyslaw Koltermann
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDropsolid
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesJérôme Petazzoni
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 

Similar to Develop QNAP NAS App by Docker (20)

Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
 
Why you’re going to fail running java on docker!
Why you’re going to fail running java on docker!Why you’re going to fail running java on docker!
Why you’re going to fail running java on docker!
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
From zero to Docker
From zero to DockerFrom zero to Docker
From zero to Docker
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Nova
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in description
 
Docker as an every day work tool
Docker as an every day work toolDocker as an every day work tool
Docker as an every day work tool
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google CloudDrupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Introducing Docker
Introducing DockerIntroducing Docker
Introducing Docker
 
App container rkt
App container rktApp container rkt
App container rkt
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 

Recently uploaded

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Develop QNAP NAS App by Docker

  • 1. Develop QNAP NAS App by Docker Terry Chen 陳彥村 Engineer @ QNAP
  • 2. Who am I? https://tw.linkedin.com/in/seterrychen https://github.com/seterrychen https://twitter.com/seterrychen ● Backend engineer : Java, Python, Linux ● QNAP Container Station/Linux Station
  • 3. Outline ● How to develop QNAP NAS App ● Base knowledge of Docker ● Create Docker App on QNAP NAS in QPKG format
  • 4. NAS - Network attached storage From : http://www.slideshare.net/QNAP_Inc/general-tech-trainingstorageabcqnap20140302compressed-copy Network
  • 5. QNAP AppCenter ● Customize your QNAP NAS with Apps
  • 6. QPKG ● QNAP package, like deb(Debian/Ubuntu), rpm(Red Hat/CentOS) ● QNAP tool-chain: https://sourceforge.net/projects/qosgpl/files/QNAP%20NAS%20Tool%20Chains/ ● QPKG format: [/share/CACHEDEV3_DATA/.qpkg/QDK/tester] # ls arm-x09/ arm-x31/ config/ package_routines shared/ x86_64/ arm-x19/ arm-x41/ icons/ qpkg.cfg x86/ x86_ce53xx/
  • 7. Package application by QDK/QDK2 ● QDK http://www.qnap.com.tw/event/dev/cht/p_qdk.php ● QDK2 https://github.com/qnap-dev/qdk2 ● QDK2 with Docker https://github.com/fcwu/docker-qdk2
  • 9. QDK2 ● https://github.com/qnap-dev/qdk2 ● Debian/Ubuntu base tool ● Support various source
  • 11. What is Docker? ● Docker allows you to package an application with all of its dependencies into a standardized unit for software development. Others App image
  • 12. Images center - Docker Hub
  • 13. How to ship application by Docker 892607a8d00b 0 B 0b10aa9d5e8a 0 B f4e6d72dbf27 22 B 9c6eed7ce0e9 57.66 MB 2eda4505e518 0 B 2a6ec6bae792 0 B 32f2a4cccab8 0 B 70e9a6907f10 125.1 MB nginx:1.10 Image Layer $ docker pull nginx:1.10
  • 14. Docker storage (version: 1.9.1) vagrant@test:~$ sudo docker info Containers: 0 Images: 2 Server Version: 1.9.1 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs ……… 892607a8d00b 0 B 0b10aa9d5e8a 0 B f4e6d72dbf27 22 B 9c6eed7ce0e9 57.66 MB 2eda4505e518 0 B 2a6ec6bae792 0 B 32f2a4cccab8 0 B 70e9a6907f10 125.1 MB Nginx:1.10 vagrant@test:~$ sudo ls -l /var/lib/docker/aufs/diff total 32 drwxr-xr-x 2 root root 4096 May 1 07:40 0b10aa9d5e8a3dd8de176539bd... drwxr-xr-x 2 root root 4096 May 1 07:39 2a6ec6bae79235ea27adcceff6... drwxr-xr-x 2 root root 4096 May 1 07:39 2eda4505e518d08147e4fab915... drwxr-xr-x 2 root root 4096 May 1 07:15 32f2a4cccab87ff519e17c9cf4... drwxr-xr-x 21 root root 4096 May 1 07:15 70e9a6907f1068b3e08a9e6357... drwxr-xr-x 2 root root 4096 May 1 07:40 892607a8d00ba2ad196a7d8a43... drwxr-xr-x 7 root root 4096 May 1 07:40 9c6eed7ce0e9c7f8ab8e95d2f7... drwxr-xr-x 3 root root 4096 May 1 07:40 f4e6d72dbf272d7e2ba0ef48f7...
  • 15. Docker storage (version: 1.9.1) vagrant@test:~$ sudo docker info Containers: 0 Images: 2 Server Version: 1.9.1 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs ……… 892607a8d00b 0 B 0b10aa9d5e8a 0 B f4e6d72dbf27 22 B 9c6eed7ce0e9 57.66 MB 2eda4505e518 0 B 2a6ec6bae792 0 B 32f2a4cccab8 0 B 70e9a6907f10 125.1 MB Nginx:1.10 root@test:/var/lib/docker/aufs/diff/70e9a6907f1068b3e08a9e...# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var root@test:/var/lib/docker/aufs/diff/9c6eed7ce0e9c7f8ab8e95...# ls etc lib tmp usr var
  • 16. AUFS – Another Union File System From : https://docs.docker.com/engine/userguide/storagedriver/aufs-driver/
  • 17. Run container (version: 1.9.1) $ docker run -d -p 80:80 nginx:1.10 Docker Client Docker Daemon Send Request 892607a8d00b 0 B 0b10aa9d5e8a 0 B f4e6d72dbf27 22 B 9c6eed7ce0e9 57.66 MB 2eda4505e518 0 B 2a6ec6bae792 0 B 32f2a4cccab8 0 B 70e9a6907f10 125.1 MB Read/Writer Container Layer Nginx:1.10 Send Response Image read only Simplified diagram
  • 18. copy-on-write strategy 892607a8d00b 0 B 0b10aa9d5e8a 0 B f4e6d72dbf27 22 B 9c6eed7ce0e9 57.66 MB 2eda4505e518 0 B 2a6ec6bae792 0 B 32f2a4cccab8 0 B 70e9a6907f10 125.1 MB Read/Writer Image read only Nginx:1.10 Read/Writer Read/Writer Container-1 Container-2 Container-3
  • 19. Basic isolation of Linux ● chroot – change root directory root@test:/var/lib/docker/aufs/diff/70e9a6907f1068b3e08a9e...# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var root@test:/var/lib/docker/aufs/diff/70e9a6907f1068b3e08a9e...# chroot . bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) root@test:/# ls -al bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var root@test:/# ls -al ../ bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
  • 20. Basic isolation of Linux ● chroot – change root directory Filesystem Isolation root@test:/# mount -t proc proc /proc vagrant@test:~$ ps -ef root 2192 906 0 02:54 ? 00:00:00 docker-proxy -proto ... root 2215 906 0 02:54 ? 00:00:00 docker-proxy -proto ... ...... vagrant 2275 1915 0 03:03 pts/5 00:00:00 ps -ef # using chroot root@test:/# ps -ef root 2192 906 0 02:54 ? 00:00:00 docker-proxy -proto ... root 2215 906 0 02:54 ? 00:00:00 docker-proxy -proto ... ...... root 2277 2269 0 03:03 ? 00:00:00 ps -ef
  • 21. How to isolate by Docker ● Linux Kernel feature: – Cgroups – Namespaces ● Mount namespaces ● UTS namespaces ● IPC namespaces ● PID namespaces ● Network namespaces ● User namespaces
  • 22. Process namespace From : http://dockone.io/article/783
  • 23. Stop container From : http://dockone.io/article/783 From: https://twitter.com/turnoff_us/status/710736561676132352/photo/1
  • 24. Docker on Linux From : https://en.wikipedia.org/wiki/Docker_(software) libcontainer libvirt systemd- nspawnLXC cgroups namespaces SELinux AppArmor Netfilter Netlink capabilities Docker Linux kernel
  • 25. VM vs Container From : https://www.docker.com/what-docker
  • 26. The power of Docker From:https://yq.aliyun.com/articles/32071
  • 28. Dockerize App by Dockerfile From : https://github.com/nginxinc/docker-nginx/blob/41aa13f7d2c24407e483c40fb1e8b33e73462ff1/mainline/jessie/Dockerfile
  • 29. Build and Ship ● Build – docker build -t your_account/app_name . ● Ship – docker login --username=yourname --email=youremail@company.com – docker push your_account/app_name
  • 30. Start/Stop script #!/bin/sh ... case "$1" in start) ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF) if [ "$ENABLED" != "TRUE" ]; then echo "$QPKG_NAME is disabled." exit 1 fi : ADD START ACTIONS HERE ;; stop) : ADD STOP ACTIONS HERE ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0
  • 31. Example: ghost ● Just a blogging platform https://ghost.org Build qpkg $ git clone https://github.com/fcwu/docker-qdk2.git $ cd docker-qdk2 $ docker run -it --rm -v ${PWD}/example:/example dorowu/qdk2 bash -c "cd /example; make" $ ls -l example/ghost/build/ghost_0.7.4_x86_64.qpkg -rw-r--r-- 1 u u 24242 Dec 30 13:10 example/ghost/build/ghost_0.7.4_x86_64.qpkg
  • 32. Container Station API ● Version 1.6 - qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "install"}' - qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "start"}' - qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "stop"}' - qbus post com.qnap.dqpkg/qpkg '{"qpkg": "online-document", "action": "remove"}'
  • 33. docker-compose ● docker-compose.yml of Online-document app: image: dorowu/online-document.amd64:0.8.111 ports: - "127.0.0.1:10001:5000" volumes: - /share:/share - /mnt/rf/cd:/mnt/rf/cd - /var/run/qbus.sock:/var/run/qbus.sock ● Read more: https://docs.docker.com/compose/
  • 34. Apache config ● online-document.conf ProxyPass /online-document/ws ws://127.0.0.1:10001/online-document/ws retry=0 ProxyPass /online-document/ http://127.0.0.1:10001/online-document/ retry=0
  • 35. Create Issues/Pull Request ● https://github.com/fcwu/docker-qdk2 ● https://github.com/qnap-dev/container-station-api
  • 36. How to debug (In my case) From : http://9gag.com/gag/anYZ9Eo/my-code-works-but-i-don-t-know-why
  • 37. How to Learn (In my case) “Try to learn something about everything and everything about something.” Thomas Huxley Quotes Read more : 陈天:如何快速掌握一门技术? (http://blog.jobbole.com/77712/)