Docker multiple entrypoints

后端 未结 9 870
情深已故
情深已故 2020-12-13 00:08

Say I have the following Dockerfile:

FROM ubuntu

RUN apt-get update
RUN apt-get install -y apache2
RUN apt-get install -y mongod #pretend this exists

EXPOS         


        
9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 00:13

    My solution is to throw individual scripts into /opt/run/ and execute them with:

    #!/bin/bash
    
    LOG=/var/log/all
    
    touch $LOG
    
    for a in /opt/run/*
    do
        $a >> $LOG &
    done
    
    tail -f $LOG
    

    And my entry point is just the location of this script, say it's called /opt/bin/run_all:

    ADD 00_sshd /opt/run/
    ADD 01_nginx /opt/run/
    
    ADD run_all /opt/bin/
    ENTRYPOINT ["/opt/bin/run_all"]
    

提交回复
热议问题