如何在单个文件中打包Docker映像 [英] how to package a docker image in a single file

查看:126
本文介绍了如何在单个文件中打包Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 ubuntu-dev-update-15的5GB码头工人镜像,该镜像是在本地Ubuntu 14开发机器上开发的。
在该图中,我拥有开发工作所需的一切。
现在,我需要能够将此映像发送到其他Linux主机。
这样做的程序是什么?

I have a 5GB docker image named "ubuntu-dev-update-15", which I developed on my local Ubuntu 14 dev machine. In that image I have everything I need to do my development work. Now I need to be able to send this image to a different linux host. What is the procedure for doing that?

推荐答案

在docker hub上获得一个帐户。

get an account on docker hub.

https://hub.docker.com/account/signup/

一旦注册(仅执行一次),您将从具有要推送图像的主机登录:

once signed up (only do that once), you log in from the host that has the image you want to push:

docker login
    (login with your username, password, and email address)

然后将图像推到那里。您可能需要先对其进行标记。假设您创建了一个名为mynewacc的新帐户,首先,标记您的映像:

then you push your image up there. you probably will need to tag it first. say you created a new account called mynewacc, first, you tag your image:

docker tag ubuntu-dev-update-15 mynewacc/ubuntu-dev-update-15

然后将映像推送到您的docker hub:

then push the image up to your docker hub:

docker push mynewacc/ubuntu-dev-update-15

现在使用docker的其他任何人都可以将您的映像拉下:

now anybody else with docker can pull your image down:

docker pull mynewacc/ubuntu-dev-update-15

然后运行映像:

docker run -it mynewacc/ubuntu-dev-update-15 /bin/bash

您可以跳过拉出步骤,如果图像不存在,则无论如何都会将其拉出。拉力保证您得到最新鲜的食物。

you can skip the pull step, if the image doesn't exist it will be pulled anyway. the pull guarantees you get the freshest one.

这篇关于如何在单个文件中打包Docker映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆