我编写了我的第一个 Dockerfile,以便使用 tor 和 polipo 测试 Docker。我的 Dockerfile 看起来像:
# 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
# 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
RUN mkdir scrapy
ADD scrapyTor scrapy
ADD startpolipotor.sh .
RUN chmod 775 ./startpolipotor.sh
我的 startpolipotor.sh 包含 3 行:
#!/bin/bash
/etc/init.d/tor start &
/etct/init.d/polipo start &
但是当我启动这个命令时:
docker run -i -t id_image /bin/bash
当我启动时,一旦进入容器ps
,我什么也看不到。我该如何解决这个问题?