Docker Entry Point with Script Arguments

In Dockerfile we can define entry point as below :-

From Wildfly 
ENTRYPOINT["/opt/jboss/wildfly/bin/", "-b", ""]

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

  • Reload code inside docker container. PM2. Node js
  • Apache HTTP ProxyPass inside Docker container linked to other containers: Wrong remote IP interpreted by linked container
  • What's the mechanism of Inner Load Balancing along with docker swarm v1.12
  • Docker how to create container
  • Elastic Beanstalk Single-Container Docker current container name
  • Run tests using Jenkins in a Docker Container
  • docker run -it --entrypoint /opt/jboss/wildfly/bin/ -Ddb_driver=mysql -b -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?

  • dokku - Run Rails 4 app from Subfolder
  • Accessing tag as an environment variable inside a Docker container
  • docker-compose returning non-zero code: 100
  • How can I mount a user's existing .ssh directory into a Docker container?
  • How to move docker network from old to new container?
  • Unable to run Registrator using docker-compose. Get connection refused error
  • 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/"]
    CMD ["-b", ""]

    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 -Duser=root

    Will run:

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