Docker 在阿尔卑斯码头重新启动tor

Docker 在阿尔卑斯码头重新启动tor,docker,alpine,tor,Docker,Alpine,Tor,我在下面创建了这个docker图像。我想在不重新启动容器的情况下重新启动Tor。我该怎么做 码头工人形象: # set alpine as the base image of the Dockerfile FROM alpine:edge # update the package repository and install Tor RUN apk update RUN apk upgrade --no-cache RUN apk add --no-cache tor RUN apk add

我在下面创建了这个docker图像。我想在不重新启动容器的情况下重新启动Tor。我该怎么做

码头工人形象:

# set alpine as the base image of the Dockerfile
FROM alpine:edge

# update the package repository and install Tor
RUN apk update
RUN apk upgrade --no-cache
RUN apk add --no-cache tor
RUN apk add --no-cache bash
RUN apk add --no-cache build-base
RUN apk add --no-cache python3
RUN apk add --no-cache python3-dev
RUN apk add py3-pip
RUN pip3 install --no-cache-dir --upgrade pip
RUN apk add --no-cache openrc

# python library
RUN pip3 install Flask


# Copy over the torrc created above and set the owner to `tor`
RUN echo "Log notice stdout" >> /etc/tor/torrc
RUN echo "SocksPort 0.0.0.0:9050" >> /etc/tor/torrc
RUN chown -R tor /etc/tor

COPY ./app.py /app.py
# RUN echo "tor -f /etc/tor/torrc &" >> /start.sh
RUN echo "rc-service tor start" >> /start.sh
RUN echo "python3 app.py" >> /start.sh

RUN chmod +x /start.sh

EXPOSE 8000
EXPOSE 9050


# Set the default container command
# This can be overridden later when running a container
ENTRYPOINT [ "/bin/bash" ]
CMD [ "/start.sh" ]

py是一个rest api代码,我想从那里重新启动tor

重新启动的常用方法是停止、删除并重新运行Docker容器。如果您试图避免重新启动容器中的第二个进程,更好的做法是将其拆分为第二个容器。