将Docker映像作为容器运行 [英] Run a Docker image as a container

查看:63
本文介绍了将Docker映像作为容器运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

dockerfile 构建Docker映像后,我看到该映像已成功构建,但是该如何处理?我不应该能够将其作为容器运行吗?

After building a Docker image from a dockerfile, I see the image was built successfully, but what do I do with it? Shouldn't i be able to run it as a container?

推荐答案

具体运行方式取决于您是否给了

The specific way to run it depends on whether you gave the image a tag/name or not.

$ docker images
REPOSITORY          TAG                 ID                  CREATED             SIZE
ubuntu              12.04               8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)

带有名称(让我们使用 Ubuntu ):

With a name (let's use Ubuntu):

$ docker run -i -t ubuntu:12.04 /bin/bash

没有名称,仅使用ID:

Without a name, just using the ID:

$ docker run -i -t 8dbd9e392a96 /bin/bash

请参阅 Docker运行参考 了解更多信息。

Please see Docker run reference for more information.

这篇关于将Docker映像作为容器运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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