Docker.io init.d script not working on start container

后端 未结 5 1575
故里飘歌
故里飘歌 2021-02-02 17:31

I\'ve a container with odoo on it on the dir \"/opt/odoo/\".

A init script on \"/etc/init.d/odoo-server\"

#!/bin/bash
### BEGIN INIT INFO
# Provides:            


        
5条回答
  •  日久生厌
    2021-02-02 18:04

    I found that the service not starting is because of the /usr/sbin/policy-rc.d returns a 101 code:

    See: http://jpetazzo.github.io/2013/10/06/policy-rc-d-do-not-start-services-automatically/

    And docker set it to return 101 in a container.

    So, change that script on build will work, you can make a build.sh to run in Dockerfile and runs the below script:

    cat << EOF > /usr/sbin/policy-rc.d
    #!/bin/sh
    
    # For most Docker users, "apt-get install" only happens during "docker build",
    # where starting services doesn't work and often fails in humorous ways. This
    # prevents those failures by stopping the services from attempting to start.
    
    # exit 101
    exit 0
    EOF
    

提交回复
热议问题