Copy Docker images from one host to another without using a repository

NottDev
1 min readSep 4, 2019

--

บทความนี้แนะนำวิธีการคัดลอก docker image จาก host หนึ่ง ไปยังอีก host หนึ่ง ในที่นี้ คือ เครื่องใน local (macOS)

เริ่มจากเข้าไปยัง host ต้นทางที่ต้องการคัดลอก docker image แล้วสั่งคำสั่งสำหรับ save image ดังนี้

docker save -o <path for generated tar file> <image name> 

จากนั้นทำการคัดลอกหรือโอนย้าย image ที่ได้ไปยัง host ปลายทาง ด้วยวิธีต่างๆเช่น cp, scp หรือ rsync (สำหรับไฟล์ขนาดใหญ่)

ตัวอย่างในที่นี่จะใช้วิธี scp สำหรับการคัดลอก image file จาก remote server มายัง เครื่อง local (macOS)

scp <username>@<remote>:/file/to/send /where/to/put

ขั้นตอนสุดท้าย คือ การ load image เข้า docker ในครื่อง local

docker load -i <path to image tar file>

scp เป็นคำสั่งคัดลอก file ข้อมูลแบบเข้ารหัสความปลอดภัย ด้วยพื้นฐานคำสั่ง ssh

--

--

NottDev
NottDev

Written by NottDev

Your only limit is your mind.

No responses yet