Run a Docker Image as a Container
I built a docker image from a dockerfile. I see the image was built successfully, but what do I do with it? Shouldn't it be able to run as a container?
New to docker so probably a misunderstanding on my end, any help would be great.
The specific way to run it depends on whether you gave the image a tag/name or not.
$ docker images
root@dockertest:~# docker images
REPOSITORY TAG ID CREATED SIZE
ubuntu 12.04 8dbd9e392a96 4 months ago 131.5 MB (virtual 131.5 MB)
With a name (let's use ubuntu):
$ docker run -i -t ubuntu:12.04 /bin/bash
Without a name, just using the ID:
$ docker run -i -t 8dbd9e392a96 /bin/bash
Please see https://docs.docker.com/engine/reference/run/ for more information.
Do following steps :
$ docker images
you will get list of all local docker images with tags specified.
$ docker run image_name:tag_name
If you didn't specify tag_name
it will automatically run image with 'latest' tag.
Instead of image_name
you can also specify Image Id (no tag_name).
$ docker images
$ docker run -d --restart=always -p 80:80 image_name:version
链接地址: http://www.djcxy.com/p/30140.html
上一篇: 如何在生产中扩展Docker容器
下一篇: 将Docker镜像作为容器运行