When using Dockerfile to make a mirror, how to set the application to boot

The following is a simple production haproxy mirror Dockerfile, set the CMD container to start the implementation of the command regardless of the following command 1, or command 2, a start hung up, but the command is set to / bin / bash, you can normal Start, ask, how to set up cmd, but only start haproxy not start bash, thank you.

  FROM centos 
MAINTAINER liuyi <liuyi@wulian.com>
RUN yum install haproxy -y
EXPOSE 80 443

Command one:

  CMD ["/usr/sbin/haproxy" ,"-f"," /etc/haproxy/haproxy.cfg "] 

Command two:

  COPY start.sh /start.sh 
CMD ["/start.sh"]

  [Root @ safe-centos7 ~] # cat start.sh 

! / Bin / bash

/ Usr / sbin / haproxy -f /etc/haproxy/haproxy.cfg

2015-05-24 add comment share it

  • Weibo
  • Micro letter

Did not find the relevant results


    Tifayuki – Tutum engineer

    We agreed from:

    Simply put, with the -db parameter to start,
    Detailed reference can be made
    Https://github.com/tutumcloud/ … proxy

    Heads up! This alert needs your attention, but it's not super important.