2024年3月28日 星期四

Docker v.26開啟管理port:2375

官方文件有2種修改方法:

Configuring remote access with systemd unit file

└→不想動到服務設定,不管是docker.service設定檔本身或是override.conf。

Configuring remote access with daemon.json

└→無法啟動服務,因為設定與docker.service設定檔沖突。


解決方法:

編輯/etc/default/docker,新增DOCKER_OPTS="-H tcp://0.0.0.0:2375"

再執行sudo systemctl daemon-reload && sudo systemctl restart docker,

並驗證如下:

$ sudo netstat -lntp | grep dockerd

tcp6       0      0 :::2375                 :::*                    LISTEN      534451/dockerd

2024年3月24日 星期日

Windows 10啟動資料夾路徑

 1.全部使用者:Windows鍵 + R鍵→輸入shell:common startup

或路徑C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

2.個別使用者:Windows鍵 + R鍵→輸入shell:startup

或路徑C:\Users\<使用者帳號>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

2024年3月20日 星期三

Git on Linux: server certificate verification failed. CAfile: none CRLfile: none

 狀況:

在Linux平台使用git push/pull/clone等指令遇到錯誤如下,

SomeUser@SomeServer:~/SomeRepogit pull

fatal: unable to access 'https://mygit.com/SomeRepo.git/': server certificate verification failed. CAfile: none CRLfile: none



解法:

SomeRepo主機SSL憑證上傳至該Linux平台主機存放憑證處即可。

(本例為/etc/ssl/certs/,可用`curl-config --ca`查詢存放處。)

2024年3月19日 星期二

Git on Windows: SSL certificate problem: unable to get local issuer certificate

狀況:

在Windows平台使用git push/pull/clone等指令遇到錯誤如下,

D:\SomeRepo>git pull

fatal: unable to access 'https://mygit.com/SomeRepo.git/': SSL certificate problem: unable to get local issuer certificate


解法:

設定Windows憑證儲存機制即可。

D:\SomeRepo>git config --system http.sslbackend "schannel"

2024年3月13日 星期三

MySQL容器SQL腳本初始化UTF8內容為亂碼

原因:因為執行初始化的終端環境語系不是UTF-8。

解法:在docker-compose.yml MySQL服務的環境變數加上"LANG: C.UTF-8"即可。


version : '3.8'
services:
  mysql:
  ..............
    environment:
      LANG: C.UTF-8 #加上這行
      

參考來源:Docker Mysql DB 初始化 UTF8 乱码问题的解决

2024年3月8日 星期五

docker compose v1遷移到v2指令的變化

 影響:

docker-compose指令在v2版本改成docker compose(整合進docker變成副指令)

有些舊專案卻還是用v1版本的docker-compose造成執行異常(找不到指令)


解法:

1. 建立捷徑檔(user@host:~sudo /bin/docker-compose)

2. 新增內容(user@host:~docker compose --compatibility "$@")

3. 增加捷徑檔執行權限(user@host:~sudo chmod +x /bin/docker-compose)

4. docker compose與docker-compose都能執行成功


參考來源:How to alias docker-compose to docker compose?

2024年3月5日 星期二

假的SMTP伺服器


version: "3.8"

services:
  fake-smtp-server:
    container_name: fake-smtp-server
    image: gessnerfl/fake-smtp-server:latest
    restart: always #重開機自動帶起
    ports:
      - "465:465"
      - "8081:8081"
      - "8082:8082"
    environment:
      - FAKESMTP_PORT=465 #SMTP埠號
      - SERVER_PORT=8081 #Web管理介面埠號
      - MANAGEMENT_SERVER_PORT=8082 #API埠號
    volumes:
      - /etc/timezone:/etc/timezone # 使用宿主機時區
      - /etc/localtime:/etc/localtime # 使用宿主機時間
啟動後連接到http://<假的SMTP伺服器位址>:8081/可以看到所寄送的郵件列表。










參考來源:Fake SMTP Server