How to Overwrite Parent Mirror entrypoint in docker

  docker, question

Ask a question:
Both the parent mirror and the child mirror specify entrypoint.
The child mirror does not appear to override the parent mirror’s entrypoint
How can I overwrite the parent mirror’s entrypoint?

In fact, the child mirror’s ENTRYPOINT can override the parent mirror’s ENTRYPOINT. Consider an example:

Parent mirror Dockerfile

FROM ubuntu:14.04
 ENTRYPOINT ["whoami"]

Build parent mirror

sudo docker build -t kiwenlau/father .

Submirror Dockerfile

FROM kiwenlau/father
 ENTRYPOINT ["hostname"]

Build submirror:

sudo docker build -t kiwenlau/son .

Run parent mirror:

sudo docker run kiwenlau/father
 root

Run submirror

sudo docker run kiwenlau/son
 cb2b314c47db

It can be seen that the parent mirror outputs the username in the container, while the child mirror outputs the hostname of the container. ENTRYPOINT of child mirror overrides ENTRYPOINT of parent mirror