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

  • Issue with the NPM
  • unable to connect to dockerized mysql container locally
  • How to mount openstack container in a docker container
  • Docker / congifparser error in requirements.txt
  • Unable to discover docker containers
  • Why are we using docker-registry?
  • 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.

  • Return 400 when i use kubernetes Deployment rollback API
  • Opening Ipython notebook from boot2docker in windows
  • How to SSH to docker container in kubernetes cluster?
  • How to connect multiple Docker containers in AWS ElasticBeanstalk?
  • problems using Ansible to run docker tasks on OS X
  • Internet access lost on host after docker installation on linux Mint 17
  • 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.