7

Windows Docker Image 相關問題:invalid tar header

 1 year ago
source link: https://blog.darkthread.net/blog/docker-invalid-tar-header-error/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Windows Docker Image 相關問題:invalid tar header-黑暗執行緒

換了新工作機,跑 Docker Desktop 是件輕鬆愉快的小事。於是我把部署到 Linux 主機的操作步驟改成:在 Windows Build Docker 容器 Image,匯出 Image 並壓縮成 tar.gz / tgz,scp 上傳後用 docker load 或 import 載入,但有時會失敗:

Fig1_638082388628504104.png

錯誤訊息為:archive/tar: invalid tar header

查到這是 Windows 與 Unix 的 STDOUT/STDIN 差異造成的問題,我習慣使用 docker save image-name > image-name.tar 匯出 Image,Winows 匯出的檔案拿到 Linux 匯入時便會出錯。解法方法很簡單:

docker save image-name -o image-name.tar
docker save image-name --output image-name.tar

改用 -o 或 --output 參數指定輸出檔案,即可避免問題。

Windows / Linux 混合應用容易發生的小問題,解法很簡單,有遇到才會知道,留篇文章增加 Google 找到答案的機率。

and has 0 comments

Comments

Be the first to post a comment

Post a comment

Comment
Name Captcha 52 - 0 =

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK