Will the application run as PID 1 and will signals be received if we bootstrap it in a entrypoint.sh?

前端 未结 2 1023
没有蜡笔的小新
没有蜡笔的小新 2021-01-20 18:37

It\'s good practice to start the service with

CMD [\"/go/bin/myapp\"]

instead of

CMD /go/bin/myapp

In the

2条回答
  •  没有蜡笔的小新
    2021-01-20 19:18

    Quoting the tini GitHub page:

    If you are using Docker 1.13 or greater, Tini is included in Docker itself. This includes all versions of Docker CE. To enable Tini, just pass the --init flag to docker run.

    Or you can you use minit. It runs /etc/minit/startup on container startup and /etc/minit/shutdown when a container is stopped. I usually use this piece of code as entrypoint:

    #!/bin/sh
    
    if [ $# -gt 0 ] ; then
            exec "$@"
    else
            exec /sbin/minit
    fi
    

提交回复
热议问题