In this docker article, we will be looking how to build docker image with including ENTRYPOINT in Linux.
Following command lets build container image in linux.
docker build ... other parameters ...
Lets see it in ubuntu linux shell example.
In above example, we used "docker build" to build our image.
To look in detail what we did there; we first created a build file called "dockerfile". Inside the file we added which repository image will be used as base image and further we added our custom codes. Furthermore, we added "ENTRYPOINT".
FROM ubuntu
RUN echo "we call our shell script here.."
ENTRYPOINT echo "entrypoint layer is triggered"
Each line starting with "RUN" will be our custom entries. For demonstration purpose, we only added a bash echo message to see it. we used "-t" parameter to give a name to our image as tagging. "." tells bash that our build file is located within directory we are inside.
As we check with "docker images", our build image has been added to docker container images in our local docker repository with name "dok3". As last step, we run our container to test it out.
Notice that "ENTRYPOINT" layer is processed when we call run docker container bash.