Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)

So I created a docker image of my own using dockerfile. But I am now confused with what to do with this image. How do i start it up? how to run it as a container?

closed

1 Answer

+1 vote
by (6.9k points)
selected by
 
Best answer

So first let me clear a thing, a docker image is sort of a blueprint that will be used to create a container. It cannot run by itself, you will have to use $ docker run command to start a container based on it.

But first list down all the docker images you have using this command

docker images

then once you find your image copy its name or id and use it in the below command

docker run [options] --name [ name of the container ] [name of the image ]

example Here :

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

starting the container :

$ docker run -it -p 80:80 --name ubuntucontainer ubuntu:12.04 

Hope this helps


Also If you want to become more adept with docker you can check this Docker training course . You will be trained by industry professionals who have years of experience in docker. Or you can refer to the docker tutorial for beginners blog

Related questions

Browse Categories

...