iamarunk
iamarunk

Reputation: 145

Starting Multiple service in Dockefile

I have one dockerfile as below.

FROM centos:centos6
RUN yum install httpd* -y
RUN yum install mysql* -y
ENTRYPOINT service mysqld start && bash
ENTRYPOINT service httpd start && bash

Docker file running successful but when i enter into the container only one service is in start start that is httpd.

I want to start both the service automatically using dockerfile.

Please let us know how to do that

Upvotes: 1

Views: 72

Answers (1)

Nguyen Sy Thanh Son
Nguyen Sy Thanh Son

Reputation: 5376

You should create a entrypoint.sh file:

#!/bin/bash    
service mysqld start
service httpd start

And Dockerfile:

FROM centos:centos6
RUN yum install httpd* -y
RUN yum install mysql* -y
COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

You also try to use supervisord in your docker image

Upvotes: 1

Related Questions