Docker Entry Point with Script Arguments

In Dockerfile we can define entry point as below :-

From Wildfly 
ENTRYPOINT["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]

But i want to pass entry point while we start the container with some argument as below :-

  • Jenkins - Dockerfile build upon another dockerfile in private repo
  • Docker & Excelsior JET
  • Which application container is better for Docker container?
  • Docker : publish port automatically with exact port number match
  • Docker missing layer IDs in output
  • Docker + SSH + Git Clone Isssue
  • docker run -it --entrypoint /opt/jboss/wildfly/bin/standalone.sh -Ddb_driver=mysql -b 0.0.0.0 -Duser=root  Wildfly 
    

    but its not working because docker try to evaluate script argument (-D and -b) as docker command parameter. I gave entrypoint in quote as well but its not working.

    How can i pass script argument in docker entrypoint?

  • How to get Docker to run on a Windows System behind a corporate firewall?
  • Error while configuring UCP replica
  • Set PortBindings config for ContainerCreate function in golang sdk for docker api
  • Docker and TexStudio: QGtkStyle could not resolve GTK
  • Docker - any way to give access to host USB or serial device?
  • Pbs with python tempfile.mkdtemp in gitlab-ci docker
  • One Solution collect form web for “Docker Entry Point with Script Arguments”

    --entrypoint only allows to specify a single string which is interpreted as name/path of the binary to start. This is different from what you can specify in the Dockerfile, as it allows to specify json arrays.

    Also, ENTRYPOINT in Dockerfiles actually serves a different purpose then what you are using it for. ENTRYPOINT should only specify the entry binary to call, while CMD specifies the arguments to that binary. If there is no ENTRYPOINT specified, CMD becomes the entrypoint while also containing the arguments.

    This should work for you:

    ENTRYPOINT ["/opt/jboss/wildfly/bin/standalone.sh"]
    CMD ["-b", "0.0.0.0"]
    

    When docker run is called without arguments now, it will use the value of CMD as arguments to the entrypoint. When it is called with arguments, the specified arguments are appended to the entrypoint instead of what was defined in CMD. For example:

    docker run -it Wildfly -Ddb_driver=mysql -b 0.0.0.0 -Duser=root
    

    Will run:

    /opt/jboss/wildfly/bin/standalone.sh -Ddb_driver=mysql -b 0.0.0.0 -Duser=root
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.