Docker Alpine linux running 2 programs

后端 未结 2 367
陌清茗
陌清茗 2020-12-10 20:08

I am trying to create docker image with alpine linux, which after run will create container with 2 running programs. This 2 (in my opinion - I don\'t know docker well) can\'

2条回答
  •  攒了一身酷
    2020-12-10 20:25

    I would suggest to look at supervisord approach. You can find how to use it in docker documentation.

    Some example:

    1. Dockerfile is:

    FROM alpine:latest
    RUN apk update && apk add --no-cache supervisor openssh nginx
    COPY supervisord.conf /etc/supervisord.conf
    CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
    

    2. supervisord.conf is:

    [supervisord]
    nodaemon=true
    
    [program:sshd]
    command=/usr/sbin/sshd -D
    
    [program:nginx]
    command=nginx -c /etc/nginx/nginx.conf
    

提交回复
热议问题