- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我有一个目录apkmirror-scraper-compose
,结构如下:
.
├── docker-compose.yml
├── privoxy
│ ├── config
│ └── Dockerfile
├── scraper
│ ├── Dockerfile
│ ├── newnym.py
│ └── requirements.txt
└── tor
└── Dockerfile
我正在尝试运行以下 docker-compose.yml
:
version: '3'
services:
privoxy:
build: ./privoxy
ports:
- "8118:8118"
links:
- tor
tor:
build:
context: ./tor
args:
password: ""
ports:
- "9050:9050"
- "9051:9051"
scraper:
build: ./scraper
links:
- tor
- privoxy
tor
的 Dockerfile
在哪里
FROM alpine:latest
EXPOSE 9050 9051
ARG password
RUN apk --update add tor
RUN echo "ControlPort 9051" >> /etc/tor/torrc
RUN echo "HashedControlPassword $(tor --quiet --hash-password $password)" >> /etc/tor/torrc
CMD ["tor"]
privoxy
是
FROM alpine:latest
EXPOSE 8118
RUN apk --update add privoxy
COPY config /etc/privoxy/config
CMD ["privoxy", "--no-daemon"]
其中 config
由两行组成
listen-address 0.0.0.0:8118
forward-socks5 / tor:9050 .
scraper
的 Dockerfile
是
FROM python:2.7-alpine
ADD . /scraper
WORKDIR /scraper
RUN pip install -r requirements.txt
CMD ["python", "newnym.py"]
其中 requirements.txt
包含单行 requests
。最后,程序 newnym.py
旨在简单地测试使用 Tor 更改 IP 地址是否有效:
from time import sleep, time
import requests as req
import telnetlib
def get_ip():
IPECHO_ENDPOINT = 'http://ipecho.net/plain'
HTTP_PROXY = 'http://privoxy:8118'
return req.get(IPECHO_ENDPOINT, proxies={'http': HTTP_PROXY}).text
def request_ip_change():
tn = telnetlib.Telnet('tor', 9051)
tn.read_until("Escape character is '^]'.", 2)
tn.write('AUTHENTICATE ""\r\n')
tn.read_until("250 OK", 2)
tn.write("signal NEWNYM\r\n")
tn.read_until("250 OK", 2)
tn.write("quit\r\n")
tn.close()
if __name__ == '__main__':
dts = []
try:
while True:
ip = get_ip()
t0 = time()
request_ip_change()
while True:
new_ip = get_ip()
if new_ip == ip:
sleep(1)
else:
break
dt = time() - t0
dts.append(dt)
print("{} -> {} in ~{}s".format(ip, new_ip, int(dt)))
except KeyboardInterrupt:
print("Stopping...")
print("Average: {}".format(sum(dts) / len(dts)))
docker-compose build
构建成功,但如果我尝试 docker-compose up
,我会收到以下错误消息:
Creating network "apkmirrorscrapercompose_default" with the default driver
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
我尝试搜索有关此错误消息的帮助,但找不到任何帮助。是什么导致了这个错误?
最佳答案
我看到它表明 docker 可能处于创建网络的最大值。命令 docker network prune
可用于删除至少一个容器未使用的所有网络。
我的问题最终变成了 Robert评论:openvpn service openvpn stop
的问题“解决了”问题。
关于python - docker "ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43720339/
我正在使用 boost.pool,但我不知道何时使用 boost::pool<>::malloc和 boost::pool<>::ordered_malloc ? 所以, boost::pool<>:
我目前正在尝试从 anaconda 中的 spy 控制台运行并行代码。我相信问题可能出在我的计算机不允许 anaconda 控制 CPU 核心上,但我不知道如何解决这个问题。 另一个有趣的点是,当我运
在了解 Python 的 multiprocessing 包(对于 Python 3.4 )时,我注意到 multiprocessing.Pool 是在类 BaseContext 中定义的 上下文.p
我有这样的程序: from multiprocessing import Pool import time def f(x): # I make a heavy code here to take t
我有一个模块 A,它通过获取数据并将其发送到模块 B、C、D 等进行分析,然后将它们的结果结合在一起来执行基本的 map/reduce。 但是模块 B、C、D 等似乎不能自己创建多处理池,否则我得到
所以我有一个脚本可以连接到大约 700 个设备并执行一系列命令,然后退出。我开始使用 Multiprocessing.Pool 和 Pool.map 来减少脚本的运行时间,并允许我同时登录多个设备。
在下面的链接中有对 Pool 类的 map 方法的解释。 它似乎阻塞直到结果准备好。这意味着不需要执行 pool.close(); pool.join() 在运行 pool.map 之后,但是它在 t
context 是 class multiprocessing.pool.Pool 构造函数中的可选参数。 Documentation只说: context can be used to specif
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: What's the difference between sending -release or -dra
不确定这是否是正确的论坛。 libvirt 页面链接在这里。如果这需要张贴在不同的地方请告诉我。 virsh pool-define-as 和 create-as 有什么区别?阅读 virsh 的手册
谁能告诉我Spring Cloud Feign Client是否提供或支持Http连接池,如果可以,那么如何配置诸如池大小的设置?我似乎在官方文档中找不到此内容。谢谢你。 最佳答案 通过调查,我将尝试
我在尝试运行 Flask 应用程序时遇到了一些困难。我收到以下导入错误: File "/db/mysql_utils.py", line 2, in import mysql.conne
我有一个 Node 项目,在其中使用 pg-pool 库。我已在我的依赖项中包含以下内容: "@types/pg-pool": "0.0.3", "pg": "^7.3.0", "pg-format"
在 python 2 中,multiprocessing.dummy.Pool 和 multiprocessing.pool.ThreadPool 之间有什么区别吗?源代码似乎暗示它们是相同的。 最佳
这个问题在这里已经有了答案: Concurrent.futures vs Multiprocessing in Python 3 (6 个答案) 关闭 5 年前。 请给我解释一下这两个类有什么区别?
multiprocessing 的文档states以下关于Pool.join() : Wait for the worker processes to exit. One must call clos
我找到了一些资源,但我不确定我是否理解。 我找到的一些资源是: http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb2ff3358411d1829f00
我的 Javafx 应用程序抛出许多非法状态异常,我尚未能够在源中跟踪触发器。 任何人都可以指导我导致此问题的原因以及我应该在哪里查找原因。我很难在这里展示一些代码,因为我不知道是什么原因造成的。 任
参见下面的示例和执行结果: #!/usr/bin/env python3.4 from multiprocessing import Pool import time import os def in
我目前有一个连接到我的主数据库的开放池,它运行良好。但是现在,我想为另一个数据库打开一个新池。我完全按照设置第一个池的方式设置了新池,显然我编辑了数据库名称等。加载 setupHikari() 方法时
我是一名优秀的程序员,十分优秀!