Dockerコマンド、Dockerfile・Compose file リファレンス

Dockerfile Run multiple services in a container

Dockerコンテナ起動時のマルチサービスの実行

dockerfile

FROM ubuntu:latest
COPY my_main_process my_main_process
COPY my_helper_process my_helper_process
COPY my_wrapper_script.sh my_wrapper_script.sh
CMD ./my_wrapper_script.sh

my_wrapper_script.sh

#!/bin/bash

# turn on bash's job control
set -m

# Start the primary process and put it in the background
./my_main_process &

# Start the helper process
./my_helper_process

# the my_helper_process might need to know how to wait on the
# primary process to start before it does its work and returns


# now we bring the primary process back into the foreground
# and leave it there
fg %1

Supervisorによるマルチサービスの実行