Docker

共 9 篇文章

2023更新至docker 23.0.1的問題

1 分鐘閱讀

更新docker之後容器都暫停並出現以下錯誤

docker-compose up -d

Starting hexo-app ... error

ERROR: for hexo-app  Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown

ERROR: for app  Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown
ERROR: Encountered errors while bringing up the project.

問題在於Docker version 23.0.1, build a5ee5b1 需要apparmor 所以只要作業系統沒有安裝就會報錯

Backup mysql from docker container

1 分鐘閱讀

Introduction

為了讓想要保存下來的資料可以不會因為容器停止就蒸發掉
都會使用資料卷掛載到本地檔案系統
像Mysql的資料存放位置在/var/lib/mysql
如果需要移植到其他主機時是不能夠直接cp -r
mysql儲存的資料是會辨認主機身份,之前也發現/var/lib/mysql是不能指定在NFS這類掛載網路硬碟的位置

How to use ncat or socat to map the remote port to local server

1 分鐘閱讀

Introduction

ncat和socat都是linux的網路工具
這次主題要達成的目標用這兩個都能達成

他們可以做到: 只要是能夠訪問到的port都可以把它映射到本機的port上

寫這篇也是要介紹之前寫reverse proxy的文章的額外補充

docker瞬間佈署reverse_proxy還有SSL認證

那篇是以frp做到內網穿透,而另一個方法是結合ncat和zerotier達到相同效果
目標都是把遠端的port映射到本機的port

Ubuntu 22.04 setup after installation

2 分鐘閱讀

The following setup is my customization while ubuntu initialization

Operating System

Input method

fcitx5-rime

sudo apt install fctix5-*
im-config  

勉強適合Ubuntu22.04的中文輸入法

nfs-common

sudo apt install nfs-common
sudo mount -t nfs $remote_host:/remote/path /local/path

GNOME

window minimize

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

circle windows

gsettings set org.gnome.shell.extensions.dash-to-dock scroll-action 'cycle-windows'

If the commands are not working, you can install dconf-editor to set.

Switching between windows with scroll wheel on Ubuntu Dock
Essential Guide: How to Enable ‘Minimize on Click’ on Ubuntu Quickly

Building hexo blog using docker

2 分鐘閱讀

Introduction

目的是只需用docker-compose up -d就能快速佈署
然後docker-compose restart就能更新內容與設定

爲了能夠直接在本機撰寫文章,需要將container內的USER設定成和本機一致
這點可以使用docker run -u $(id -u):$(id -g)或在docker-compose.yml設定user參數
如果有其他管理檔案權限的解法歡迎留言分享

因此我建立了一個image: hunglin59638/hexo-blog
可透過上述操作方便管理跟快速佈署