简体   繁体   中英

How to start muli process in background with supervisor on Docker

With my dockerfile I try to run 2 process in background (Tor and Polipo) with supervisor. My Dockerfile look like that:

# Pull base image.
FROM ubuntu:latest

# Upgrade system
RUN apt-get update && apt-get dist-upgrade -y --no-install-recommends && apt-get autoremove -y && apt-get clean

# Install TOR
RUN apt-get install -y --no-install-recommends tor tor-geoipdb torsocks && apt-get autoremove -y && apt-get clean

# INSTALL POLIPO
RUN apt-get update && apt-get install -y polipo
# INSTALL SUPERVISOR
RUN apt-get install -y supervisor


# Default ORPort
EXPOSE 9001

# Default DirPort 
EXPOSE 9030

# Default SOCKS5 proxy port 
EXPOSE 9050

# Default ControlPort
EXPOSE 9051
# Default polipo Port
EXPOSE 8123

RUN echo 'socksParentProxy = "localhost:9050"'  >> /etc/polipo/config
RUN echo 'socksProxyType = socks5'  >> /etc/polipo/config
RUN echo 'diskCacheRoot = ""' >> /etc/polipo/config

RUN echo 'ORPort 9001' >> /etc/tor/torrc
RUN echo 'ExitPolicy reject *:*' >> /etc/tor/torrc
ADD supervisor_tor.conf /etc/supervisor/conf.d/tor.conf
CMD /usr/bin/supervisord -n 

and my supervisor_tor.conf look like that:

[group:tor]
programs=polipo,tor

[program:polipo]
command=/usr/bin/polipo -c /etc/polipo/config
autostart=true
autorestart=true

[program:tor]
command=/usr/bin/tor
autostart=true
autorestart=true
redirect_stderr=true

Once my countainer is running, I see all the log I don't access on the bash.

How I can start 2 process in background with supervisor ?

Thanks in advance.

I'm a little lost as I don't understand what "I see all the log I don't access on the bash" means.

However, it sounds like you the problem is you want your bash prompt back. If that's the case, just give the -d argument to docker run when starting your image. If you want to get another shell, just docker exec eg:

$ docker exec -it mycon bash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM