Docker Cookbook



Download 6,31 Mb.
Pdf ko'rish
bet41/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   37   38   39   40   41   42   43   44   ...   260
Bog'liq
Docker Cookbook

See Also

docker commit
reference

docker diff
reference
2.2 Saving Images and Containers as Tar Files for Sharing
Problem
You have created images or have containers that you would like to keep and share
with your collaborators.
Solution
Use the Docker CLI 
save
and 
load
commands to create a tarball from a previously
created image, or use the Docker CLI 
import
and 
export
commands for containers.
Let’s start with a stop container and export it to a new tarball:
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED ... NAMES
77d9619a7a71 ubuntu:14.04 "/bin/bash" 10 seconds ago ... high_shockley
$ docker export 77d9619a7a71 > update.tar
$ ls
update.tar
2.2 Saving Images and Containers as Tar Files for Sharing | 39


You could commit this container as a new image (see 
Recipe 2.1
) locally, but you
could also use the Docker 
import
command:
$ docker import - update < update.tar
157bcbb5fdfce0e7c10ef67ebdba737a491214708a5f266a3c74aa6b0cfde078
$ docker images
REPOSITORY TAG IMAGE ID ... VIRTUAL SIZE
update latest 157bcbb5fdfc ... 188.1 MB
If you wanted to share this image with one of your collaborators, you could upload
the tar file on a web server and let your collaborator download it and use the 
import
command on his Docker host.
If you would rather deal with images that you have already committed, you can use
the 
load
and 
save
commands:
$ docker save -o update1.tar update
$ ls -l
total 385168
-rw-rw-r-- 1 vagrant vagrant 197206528 Jan 13 14:13 update1.tar
-rw-rw-r-- 1 vagrant vagrant 197200896 Jan 13 14:05 update.tar
$ docker rmi update
Untagged: update:latest
Deleted: 157bcbb5fdfce0e7c10ef67ebdba737a491214708a5f266a3c74aa6b0cfde078
$ docker load < update1.tar
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
update latest 157bcbb5fdfc 5 minutes ago 188.1 MB
ubuntu 14.04 8eaa4ff06b53 12 days ago 192.7 MB
Discussion
The two methods are similar; the difference is that saving an image will keep its his‐
tory, and exporting a container will squash its history.

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   37   38   39   40   41   42   43   44   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish