How can I run multiple statements using json array format for Docker ENTRYPOINT?

I need to set ulimit and sysctl before starting my service, so I have been doing the following in my ENTRYPOINT:

ulimit -n 4096; sysctl -p; start_service

  • Firefox in a docker container accessible from selenium in another
  • Cron job break other foreground server in docker
  • Docker swarm create command difference
  • Unix protocol not supported - Docker Plugin Version - 0.16.2
  • level=fatal msg=“ipset [destroy] failed: ipset v6.29: Set cannot be destroyed: it is in use by a kernel component\n: exit status 1”
  • Nodejs error: uncaughtException: connection timeout. Occurs renadomly
  • But it seems that if I want to use CMD as default arguments to ENTRYPOINT, I have to use the json array format.

    But I don’t know how to run multiple statements using the json array format.

  • Building a docker image doesnt stop because of minecraft server continuing to run
  • Restricted Image Pull rights on Amazon ECR
  • How to continue running scripts when exiting docker containers
  • File not found in docker container
  • Pulling from a local docker image instead
  • Would Docker swarm assist me with managing containers with specific environment variables?
  • One Solution collect form web for “How can I run multiple statements using json array format for Docker ENTRYPOINT?”

    Simplest way is probably to execute it as a script (here start_service is replaced with a simple echo for testing)

    $ cat
    ulimit -n 4096; sysctl -p; echo $@
    $ cat Dockerfile
    FROM ubuntu
    COPY . /tmp
    CMD ["test"]
    ENTRYPOINT ["/tmp/"]
    $ docker build -t test .
    $ docker run test
    $ docker run test "hello world"
    hello world

    Remember to chmod 755 before building the container or the script won’t execute.

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