How do you run a Dockerfile?

A Dockerfile can be built and run in the same way a normal container is created and run.

> docker build -t <docker_hub_user_id>/<repository_name>[:version_tag] <path_to_dockerfile>

Where -t refers to an image_tag: a unique readable name assigned to the created image by the developer for future references.

Example:

> docker build -t refebruvuser/mynpm .

And is run as:

> docker run -i -t <docker_hub_user_id>/<repository_name>[:version_tag]

A Dockerfile can be built and run in the same way a normal container is created and run.

> docker build -t <docker_hub_user_id>/<repository_name>[:version_tag] <path_to_dockerfile>

Where -t refers to an image_tag: a unique readable name assigned to the created image by the developer for future references.

Example:

> docker build -t refebruvuser/mynpm .

And is run as:

> docker run -i -t <docker_hub_user_id>/<repository_name>[:version_tag]

Buy Me A Coffee

Found this article helpful? Please consider supporting!

Ram
Ram

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *