N
N
Nickname1112019-05-13 16:54:44
Docker
Nickname111, 2019-05-13 16:54:44

How to automatically start processes (tor, privoxy) in Docker with container start?

Hello! I just recently started using docker, but I don’t understand how to start processes in a container. Here is my Dockerfile:

FROM ubuntu:16.04

RUN \
    apt update && apt install -y \
        tor \
        privoxy

FROM python:3
 
WORKDIR /usr/src/app
 
COPY requirements.txt ./

RUN pip3 install --no-cache-dir -r requirements.txt

I found this tutorial about launching tor and privoxy in the docker container console: https://gist.github.com/DusanMadar/8d11026b7ce0bce... The
question arose: is it possible to run these processes together with the launch of the container (in other words, just write to the dockerfile) rather than doing it manually in the console each time?
I tried to do this through
CMD service tor start or just
CMD tor, but when I start it, it gives an error that there is no such process.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Askhat Bikmetov, 2019-05-13
@Nickname111

Why do you want to run multiple services in the same container? Docker ideology: one process - one container. The task is to isolate tor and privoxy in separate containers, and then connect - over the network or shared directories.

Z
zohan1993, 2019-05-13
@zohan1993

1. Add to Dockerfile:
CMD /etc/init.d/tor start && sleep 5 && /etc/init.d/privoxy start
2. Or add to Dockerfile:
CMD /start.sh
and stuff everything you need into start.sh run/check

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question