Skip to content

Latest commit

 

History

History
53 lines (32 loc) · 1.81 KB

entrypoint-vs-run.md

File metadata and controls

53 lines (32 loc) · 1.81 KB

How is ENTRYPOINT instruction under Dockerfile different from RUN instruction?

Tested Infrastructure

Platform Number of Instance Reading Time
Play with Docker 1 5 min

Pre-requisite

  • Create an account with DockerHub
  • Open PWD Platform on your browser
  • Click on Add New Instance on the left side of the screen to bring up Alpine OS instance on the right side

What is ENTRYPOINT meant for?

ENTRYPOINT is meant to provide the executable while CMD is to pass the default arguments to the executable. To understand it clearly, let us consider the below Dockerfile:

My Image

If you try building this Docker image using docker build command -

My Image

Let us run this image without any argument.

My Image

Let's run it passing a command line argument

My Image

This clearly state that ENTRYPOINT is meant to provide the executable while CMD is to pass the default arguments to the executable.

Contributor

Next >> Lab #17: USER instruction