Add a new entrypoint to a docker image

Recently, we decided to move one of our services to docker container. The service is product of another company and they have provided us the docker image. However, we need to do some extra configuration steps in the container entrypoint.

The first thing I tried, was to create a DockerFile from the base image and then add commands to do the extra steps, like this:

  • How and where can I see Docker image deployment structure?
  • Generic Python Object Serialization for Docker Integration
  • Docker :- Creating Databases in Postgresql Docker Container
  • Bamboo: docker task “An error occurred trying to connect: Post”
  • Docker container with Newrelic Python agent and Supervisord is not sending data
  • How to push a docker image with README file to docker hub?
  • From baseimage:tag 
    RUN chmod a+w /path/to/entrypoint_creates_this_file

    But, it failed, because these extra steps must be run after running the base container entrypoint.

    Is there any way to extend entrypoint of a base image? if not, what is the correct way to do this?


  • Lost connection to MySQL server when creating database from script in a Docker container
  • How can I share a network interface with docker without setns error?
  • Fetching AWS instance metadata from within Docker container?
  • uwsgi running in Docker can't find initializtion file
  • chown docker volumes on host (possibly through docker-compose)
  • docker entrypoint running bash script gets “permission denied”
  • 3 Solutions collect form web for “Add a new entrypoint to a docker image”

    I finally ended up calling the original entrypoint bash script in my new entrypoint bash script, before doing other extra configuration steps.

    create your custom entry-point file

    -> add this to image

    -> specify this as your entrypoint file

    FROM image:base
    COPY /path/to/ /
    // do sth here
    ENTRYPOINT ["/"]

    You do not need to even create a new Dockerfile. To modify the entrypoint you can just run the image using the command such as below:

    docker run --entrypoint new-entry-point-cmd baseimage:tag <optional-args-to-entrypoint>

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.