How can I run multiple statements using json array format for Docker ENTRYPOINT?
I need to set
sysctl before starting my service, so I have been doing the following in my
ulimit -n 4096; sysctl -p; start_service
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.
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 start.sh #!/bin/bash ulimit -n 4096; sysctl -p; echo $@ $ cat Dockerfile FROM ubuntu COPY . /tmp CMD ["test"] ENTRYPOINT ["/tmp/start.sh"] $ docker build -t test . ... $ docker run test test $ docker run test "hello world" hello world
chmod 755 start.sh before building the container or the script won’t execute.