2021年11月29日 星期一

yum localdownload and install by docker

 1. https://www.slothparadise.com/how-to-download-yum-packages-locally/ 


2. https://unix.stackexchange.com/questions/50642/download-all-dependencies-with-yumdownloader-even-if-already-installed


3. good ch

https://ephrain.net/linux-%E5%9C%A8-centos-%E4%B8%8A%E4%BD%BF%E7%94%A8-yum%EF%BC%8C%E4%B8%8B%E8%BC%89%E6%89%80%E6%9C%89%E7%9B%B8%E9%97%9C%E8%81%AF%E7%9A%84-rpm-%E5%A5%97%E4%BB%B6/


4. 

https://unix.stackexchange.com/questions/151689/how-can-i-instruct-yum-to-install-a-specific-version-of-package-x


5. good ch install docker

https://www.stepbystep.tw/blog/post/118700937-centos-7-%E5%AE%89%E8%A3%9D-docker-ce


6. rpm list

https://phoenixnap.com/kb/how-to-install-rpm-file-centos-linux


7. office install docker

https://docs.docker.com/engine/install/centos/


8. rpm list 

https://linuxhint.com/check-available-package-yum/



python module

 https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/88868/


https://docs.python.org/3/tutorial/modules.html#packages

2021年11月26日 星期五

drone

 1. 

https://www.tpisoftware.com/tpu/articleDetails/1884

https://ithelp.ithome.com.tw/articles/10240360

https://blog.wu-boy.com/2021/08/drone-license/

docker compose can commuicate

 1  

Day8 不同yml檔,也可以讓容器彼此都能溝通


只要網段一致,即可直接呼叫IP或容器名稱。因此,這邊示範如何在不同的容器中,讓他們有相同的網段。


https://ithelp.ithome.com.tw/articles/10218037

2021年11月23日 星期二

python go to pypi

 1.  打包python module 到PYPI 上


git learning

 1. https://w3c.hexschool.com/git/7b64aa34

2. https://git-scm.com/book/zh-tw/v2/Git-%E5%9F%BA%E7%A4%8E-%E5%8F%96%E5%BE%97%E4%B8%80%E5%80%8B-Git-%E5%80%89%E5%84%B2



2021年11月22日 星期一

solve: docker network can container access the localhost by host mode

 1.  

Lastly, under Linux you can run your container in the host network namespace by setting --net=host; in this case localhost on your host is the same as localhost inside the container, so containerized service will act like non-containerized services and will be accessible without any additional configuration.


docker-compose-running-containers-in-nethost

how-to-access-host-port-from-docker-container

2. other

iptables -A INPUT -i docker0 -j ACCEPT


3. ipforward

作業系統擁有 IP轉發(英語:IP forwarding功能,意味著該系統能接收從接口傳送進來的 網絡數據包(英語:network packets),如果識別到該數據包不用於該系統自身,那麼系統將會將該網絡數據包傳送到另外一個網絡去,用恰當地方式轉發該數據包。[1]

一個典型的場景是需要去搭建一個路由器以連接兩個不同網絡。


4. more discuss

https://ithelp.ithome.com.tw/articles/10206725

2021年11月15日 星期一

Centos7 yum kernel update

 # To update linux kernel

  cat /var/log/yum.log | less

   rpm -q kernel

  yum erase kernel-3.10.0-1160.45.1.el7.x86_64

yum-complete-transaction

yum check-update

yum install kernel.x86_64

2021年11月12日 星期五

python docker image choose

 1.  office lab https://hub.docker.com/_/python

Simple Tags

2.  aws
https://aws.amazon.com/cn/blogs/china/choose-the-best-docker-image-for-your-python-application/


  • Alpine 显然不适合作为Python 应用的基础映像。尽管它提供了惊人存储的空间上效率,但它对于Python包支持的不足的缺陷是难以弥补的。也许Alpine更适合于一些对于映像尺寸敏感的场合,还可以考虑将它用于你的Go 应用。



3. debian version https://www.debian.org/releases/index.zh-tw.html

發行版目錄

4.  Dissus and meaning
https://medium.com/swlh/alpine-slim-stretch-buster-jessie-bullseye-bookworm-what-are-the-differences-in-docker-62171ed4531d


docker compose

 1.  install method

https://phoenixnap.com/kb/install-docker-compose-centos-7


2.  directly download  https://github.com/docker/compose/releases



3. docker network

https://titangene.github.io/article/networking-in-docker-compose.html


https://ithelp.ithome.com.tw/articles/10242460


https://docs.docker.com/network/network-tutorial-standalone/


https://stackoverflow.com/questions/43904562/docker-how-to-find-the-network-my-container-is-in

\

https://ithelp.ithome.com.tw/articles/10205190

2021年11月11日 星期四

docker iptables

  • iptable is define in /etc/docker/daemon.json and default is false , must open it 



  •   default iptalbes

# iptables -S

-P INPUT ACCEPT

-P FORWARD ACCEPT

-P OUTPUT ACCEPT

-N DOCKER

-N DOCKER-ISOLATION-STAGE-1

-N DOCKER-ISOLATION-STAGE-2

-N DOCKER-USER

-A FORWARD -j DOCKER-USER

-A FORWARD -j DOCKER-ISOLATION-STAGE-1

-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

-A FORWARD -o docker0 -j DOCKER

-A FORWARD -i docker0 ! -o docker0 -j ACCEPT

-A FORWARD -i docker0 -o docker0 -j ACCEPT

-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2

-A DOCKER-ISOLATION-STAGE-1 -j RETURN

-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP

-A DOCKER-ISOLATION-STAGE-2 -j RETURN

-A DOCKER-USER -j RETURN


  • Look the chain

[root@localhost mybin]# iptables -L

Chain INPUT (policy ACCEPT)

target     prot opt source               destination         


Chain FORWARD (policy ACCEPT)

target     prot opt source               destination         

DOCKER-USER  all  --  anywhere             anywhere            

DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            

ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED

DOCKER     all  --  anywhere             anywhere            

ACCEPT     all  --  anywhere             anywhere            

ACCEPT     all  --  anywhere             anywhere            


Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination         


Chain DOCKER (1 references)

target     prot opt source               destination         


Chain DOCKER-ISOLATION-STAGE-1 (1 references)

target     prot opt source               destination         

DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            

RETURN     all  --  anywhere             anywhere            


Chain DOCKER-ISOLATION-STAGE-2 (1 references)

target     prot opt source               destination         

DROP       all  --  anywhere             anywhere            

RETURN     all  --  anywhere             anywhere            


Chain DOCKER-USER (1 references)

target     prot opt source               destination         

RETURN     all  --  anywhere             anywhere            

[root@localhost mybin]# iptables -L

Chain INPUT (policy ACCEPT)

target     prot opt source               destination         


Chain FORWARD (policy ACCEPT)

target     prot opt source               destination         

DOCKER-USER  all  --  anywhere             anywhere            

DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            

ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED

DOCKER     all  --  anywhere             anywhere            

ACCEPT     all  --  anywhere             anywhere            

ACCEPT     all  --  anywhere             anywhere            


Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination         


Chain DOCKER (1 references)

target     prot opt source               destination         


Chain DOCKER-ISOLATION-STAGE-1 (1 references)

target     prot opt source               destination         

DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            

RETURN     all  --  anywhere             anywhere            


Chain DOCKER-ISOLATION-STAGE-2 (1 references)

target     prot opt source               destination         

DROP       all  --  anywhere             anywhere            

RETURN     all  --  anywhere             anywhere            


Chain DOCKER-USER (1 references)

target     prot opt source               destination         

RETURN     all  --  anywhere             anywhere


##

[root@localhost mybin]# iptables-save

# Generated by iptables-save v1.4.21 on Fri Nov 12 14:52:09 2021

*filter

:INPUT ACCEPT [4092:1167973]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [3144:1537085]

:DOCKER - [0:0]

:DOCKER-ISOLATION-STAGE-1 - [0:0]

:DOCKER-ISOLATION-STAGE-2 - [0:0]

:DOCKER-USER - [0:0]

-A FORWARD -j DOCKER-USER

-A FORWARD -j DOCKER-ISOLATION-STAGE-1

-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

-A FORWARD -o docker0 -j DOCKER

-A FORWARD -i docker0 ! -o docker0 -j ACCEPT

-A FORWARD -i docker0 -o docker0 -j ACCEPT

-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2

-A DOCKER-ISOLATION-STAGE-1 -j RETURN

-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP

-A DOCKER-ISOLATION-STAGE-2 -j RETURN

-A DOCKER-USER -j RETURN

COMMIT

# Completed on Fri Nov 12 14:52:09 2021

# Generated by iptables-save v1.4.21 on Fri Nov 12 14:52:09 2021

*nat

:PREROUTING ACCEPT [24:2684]

:INPUT ACCEPT [23:2600]

:OUTPUT ACCEPT [44:2799]

:POSTROUTING ACCEPT [44:2799]

:DOCKER - [0:0]

-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER

-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER

-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE

-A DOCKER -i docker0 -j RETURN

COMMIT

# Completed on Fri Nov 12 14:52:09 2021


#ref

https://www.itread01.com/content/1549511473.html

iptables: https://www.digitalocean.com/community/tutorials/how-to-list-and-delete-iptables-firewall-rules

docker and iptables

office docker and iptables

知呼 good


csdn docker firewall


firewall cmd


easy firewall


docker firwall , 睿揚




2021年11月10日 星期三

Jupyter install

 

1. 

Jupyter Notebook 使用技巧彙整:建置不同程式語言的核心



https://medium.com/pyradise/jupyter-notebook-tricks-kernels-9350502ccb69

2. 
https://ithelp.ithome.com.tw/articles/10192614

3. office
https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

4. china
https://blog.csdn.net/donaldsy/article/details/96194346

5. 
https://tf.wiki/zh_hant/appendix/jupyterlab.html

6.
https://jupyter.readthedocs.io/en/latest/use/jupyter-directories.html

7.
https://kknews.cc/code/lmyoqne.html

8.
http://yhhuang1966.blogspot.com/2020/04/python-jupyterlab.html

9. docker
https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html

2021年11月3日 星期三

rabbitmq environment and docker file

 1. 

File and Directory Locations

https://www.rabbitmq.com/relocate.html


2.

https://hub.docker.com/_/rabbitmq

python how to package

 1. 

A sample Python project

https://github.com/pypa/sampleproject


2. 

Python Modules: Creating, Importing, and Sharing

https://stackabuse.com/python-modules-creating-importing-and-sharing/



3.

Packaging Python Projects

https://packaging.python.org/tutorials/packaging-projects/


4. 

Python: Creating a pip installable package

https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/



5. ch

https://www.gushiciku.cn/pl/gOIm/zh-tw



2021年11月2日 星期二

rabbitmq client ssl and consumer threading

0. config

https://www.cnblogs.com/masy-lucifer/p/13551090.html

 

1. ssl

https://cjshelton.github.io/blog/2019/12/18/rabbitmq-client-certificate-authentication.html


2. RabbitSSL example github

https://github.com/Nepitwin/RabbitSSL


3. closeing event

https://www.rabbitmq.com/event-exchange.html


4. mq confirm

https://blog.rabbitmq.com/posts/2011/02/introducing-publisher-confirms


5. mq reconnect

https://stackoverflow.com/questions/37182956/how-to-restart-consumer-rabbitmq-pika-python


6.  with statemnt

https://blog.gtwang.org/programming/python-with-context-manager-tutorial/


https://zcgnotes.com/python-%E4%BD%BF%E7%94%A8context-manager%E7%AE%A1%E7%90%86%E8%B3%87%E6%BA%90/


https://medium.com/@dhanushgopinath/automatically-recovering-rabbitmq-connections-in-go-applications-7795a605ca59


7. yield

https://chriskang028.medium.com/python-%E8%A3%A1%E7%9A%84-yield-%E8%AE%93%E4%BD%A0%E7%B0%A1%E5%96%AE-%E5%BF%AB%E9%80%9F%E7%9E%AD%E8%A7%A3-yield-%E7%9A%84%E6%A6%82%E5%BF%B5-f660521f3aa7


8. mq thread

https://stackoverflow.com/questions/21881533/rabbitmq-non-blocking-consumer