How do I run Apache 2 on Alpine in Docker?

后端 未结 2 1751
名媛妹妹
名媛妹妹 2021-02-12 23:05

According to Alpine wiki I have to run rc-service apache2 startafter installation of Apache 2. However, there\'s no rc-service in the Alpine running in

2条回答
  •  鱼传尺愫
    2021-02-12 23:29

    Alpine does not have rc-service installed by default. You need to install it (either as part of your Dockerfile build process or manually in the container).

    The secret invocation is:

    apk add openrc --no-cache
    

    If you want to run it from outside the container (say docker run), then use:

    docker run [options etc] bin/ash -c "apk add openrc --no-cache"
    

    PS: rc-service is good for other things and stuff like mariadb (also not included in alpine)

提交回复
热议问题