Skip to content

Zeroplex 生活隨筆

軟體開發、伺服器和生活瑣事

小 縮小字型大小。 中 重設字型大小。 大 放大字型大小。

標籤: Docker

/tmp 滿了導致 docker 出錯

Posted on 2024 年 1 月 25 日2024 年 1 月 25 日 By 日落 在〈/tmp 滿了導致 docker 出錯〉中尚無留言

docker 遇到奇怪的錯誤訊息:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
docker-compose up -d
Failed to write all bytes for unicodedata.cpython-37m-x86_64-linux-gnu.so
fwrite: No space left on device
docker-compose up -d Failed to write all bytes for unicodedata.cpython-37m-x86_64-linux-gnu.so fwrite: No space left on device
docker-compose up -d
Failed to write all bytes for unicodedata.cpython-37m-x86_64-linux-gnu.so
fwrite: No space left on device

看到 no space left 基本上先 df 看一下,剛好發現 /tmp 炸了:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
df -h
....
tmpfs 256M 256M 0 100% /tmp
df -h .... tmpfs 256M 256M 0 100% /tmp
df -h
....
tmpfs           256M  256M     0 100% /tmp

清乾淨以後就恢復正常了。

理論上 /tmp 給 256 MB 理論上應該算夠大了,被塞爆不太正常,找時間翻一下是不是有服務出錯吧


看到另個作法,是讓 docker 清除不需要的資料來釋放空間:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
docker system prune -af
docker rmi $(docker images -f dangling=true -q)
docker system prune -af docker rmi $(docker images -f dangling=true -q)
docker system prune -af

docker rmi $(docker images -f dangling=true -q)
Tags:Docker, Linux

傳資料給 docker container (as stdin)

Posted on 2023 年 12 月 29 日 By 日落 在〈傳資料給 docker container (as stdin)〉中尚無留言

遇到某個 docker container 啟動以後,顯示 press "y" to accept and continue,有夠麻煩。

若使用 docker run 時,可以加上 -i (interactive):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
echo "y" | docker run -i my_image
echo "y" | docker run -i my_image
echo "y" | docker run -i my_image 

如果是在 docker-compose.yml,則需加上幾個設定:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
image: my_image
tty: true
stdin_open: true
image: my_image tty: true stdin_open: true
image: my_image
tty: true
stdin_open: true

container 跑起來以後,透過 docker attach 轉到 container,資料輸入完畢以後連續按下「Ctrl+P Ctrl+Q」來 detach:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
docker attach my_container
y
^P ^Q
docker attach my_container y ^P ^Q
docker attach my_container
y
^P ^Q
Tags:Docker

在 Alpine Linux 安裝套件並清理

Posted on 2023 年 10 月 24 日2023 年 11 月 13 日 By 日落 在〈在 Alpine Linux 安裝套件並清理〉中尚無留言

Alpine Linux 主要是透過 apk 來管理套件。

新增套件:

apk update && \
apk add build-base autoconf automake && \
cd /path/to/source && \
make install && \
rm -fr /var/cache/apk/* && \
rm -fr /tmp/*

離開前要記得 rm -fr /var/cache/apk/* 清除暫存檔。

也可以使用 apk add --no-cache 安裝套件,這樣就不需要考慮暫存檔:

apk add --no-cache build-base autoconf automake && 
....
Tags:Docker, Linux

docker-compose.yaml for manticore

Posted on 2023 年 10 月 19 日 By 日落 在〈docker-compose.yaml for manticore〉中尚無留言

config rewrite from Manticore document :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
version: "3"
services:
manti:
image: manticoresearch/manticore:6.2.12
volumes:
- ./data:/var/lib/manticore
ports:
- 127.0.0.1:9306:9306
- 127.0.0.1:9308:9308
environment:
# un-comment to install extra plugin for manticore
#- "EXTRA=1"
version: "3" services: manti: image: manticoresearch/manticore:6.2.12 volumes: - ./data:/var/lib/manticore ports: - 127.0.0.1:9306:9306 - 127.0.0.1:9308:9308 environment: # un-comment to install extra plugin for manticore #- "EXTRA=1"
version: "3"

services:
  manti:
    image: manticoresearch/manticore:6.2.12
    volumes:
      - ./data:/var/lib/manticore
    ports:
      - 127.0.0.1:9306:9306
      - 127.0.0.1:9308:9308
    environment:
      # un-comment to install extra plugin for manticore
      #- "EXTRA=1"
Tags:Docker

在 alpine 中安裝 pdo_pgsql

Posted on 2023 年 3 月 9 日2023 年 3 月 9 日 By 日落 在〈在 alpine 中安裝 pdo_pgsql〉中尚無留言

如果只執行 docker-php-ext-install 會出現錯誤訊息:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
PHP Startup: Unable to load dynamic library 'pdo_pgsql.so'
PHP Startup: Unable to load dynamic library 'pdo_pgsql.so'
PHP Startup: Unable to load dynamic library 'pdo_pgsql.so'

必須安裝 postgresql-dev 套件,完整設定為:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
RUN apk add --no-cache postgresql-dev && \
docker-php-ext-install pdo pdo_pgsql pgsql
RUN apk add --no-cache postgresql-dev && \ docker-php-ext-install pdo pdo_pgsql pgsql
RUN apk add --no-cache postgresql-dev && \
    docker-php-ext-install pdo pdo_pgsql pgsql
Tags:Docker

文章分頁

1 2 3 下一頁

其他

關於我  (About me)

小額贊助

  文章 RSS Feed

  留言 RSS Feed

Apache AWS Bash C/C++ Docker FreeBSD GCP Git Google Java JavaScript Laravel Linux Microsoft MSSQL MySQL Nginx PHP PHPUnit PostgreSQL Python Qt Ubuntu Unix Vim Web Windows WordPress XD 作業系統 分享 好站推薦 專題 攝影 新奇搞笑 新聞 旅遊 生活雜記 程式設計 網路架站 網頁設計 資訊學習 資訊安全 遊戲 音樂


創用 CC 授權條款
本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權.