ERROR "Docker": no se pudo encontrar un grupo de direcciones IPv4 disponible que no se solapara entre los valores predeterminados para asignar a la red"
Tengo un directorio apkmirror-scraper-compose
con la siguiente estructura:
.
├── docker-compose.yml
├── privoxy
│ ├── config
│ └── Dockerfile
├── scraper
│ ├── Dockerfile
│ ├── newnym.py
│ └── requirements.txt
└── tor
└── Dockerfile
Estoy tratando de ejecutar lo siguiente 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
Donde el Dockerfile
para tor
es
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"]
Que para privoxy
es
FROM alpine:latest
EXPOSE 8118
RUN apk --update add privoxy
COPY config /etc/privoxy/config
CMD ["privoxy", "--no-daemon"]
Donde config
consiste en las dos líneas
listen-address 0.0.0.0:8118
forward-socks5 / tor:9050 .
Y el Dockerfile
para scraper
es
FROM python:2.7-alpine
ADD . /scraper
WORKDIR /scraper
RUN pip install -r requirements.txt
CMD ["python", "newnym.py"]
Donde requirements.txt
contiene la única línea requests
. Finalmente, el programa newnym.py
está diseñado para probar simplemente si cambiar la dirección IP usando Tor es trabajo:
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)))
El docker-compose build
se construye correctamente, pero si intento docker-compose up
, obtengo el siguiente mensaje de error:
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
Intenté buscar ayuda en este mensaje de error, pero no pude encontrar ninguna. ¿Qué está causando este error?
7 answers
He visto que docker sugerido puede estar en su máximo de redes creadas. El comando docker network prune
se puede utilizar para eliminar todas las redes no utilizadas por al menos un contenedor.
Mi problema terminó siendo, como Robert comentó: un problema con openvpn service openvpn stop
'resolvió' el problema.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-28 15:32:37
Me encontré con este problema porque tenía OpenVPN funcionando. Tan pronto como maté a OpenVPN, docker-compose up
se disparó y el error desapareció.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-20 01:50:08
Siguiendo El comentario de Peter Hauge , al correr docker network ls
vi (entre otras líneas) lo siguiente:
NETWORK ID NAME DRIVER SCOPE
dc6a83d13f44 bridge bridge local
ea98225c7754 docker_gwbridge bridge local
107dcd8aa889 host host local
La línea con NAME
y DRIVER
como ambos host
parece ser a lo que se refiere con "redes ya creadas en su host". Así, siguiendo https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430, corrí el comando
docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }')
Ahora docker-compose up
funciona (aunque newnym.py
produce un error).
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-01-13 14:49:09
Puedes probar
$sudo service network-manager restart
Funcionó para mí.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-05 15:47:53
Tuve el mismo problema con el mismo mensaje de error, pero la solución con la eliminación de redes docker no utilizadas no me ayudó. He eliminado todas las redes no predeterminadas de docker (y todas las imágenes y contenedores también), pero no ayudó - docker todavía no fue capaz de crear una nueva red.
La causa del problema fueron las interfaces de red que se fueron después de la instalación de openvpn. (Se instaló en el host previamente.) Los encontré ejecutando ifconfig
comando:
...
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.2 P-t-P:10.8.0.2 Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:75 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:84304 (84.3 KB) TX bytes:0 (0.0 B)
tun1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.2 P-t-P:10.8.0.2 Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:200496 errors:0 dropped:0 overruns:0 frame:0
TX packets:148828 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:211583838 (211.5 MB) TX bytes:9568906 (9.5 MB)
...
He encontrado que puedo eliminarlos con un par de comandos:
ip link delete tun0
ip link delete tun1
Después de que este problema haya desaparecido.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-25 19:46:09
- Compruebe si se está ejecutando cualquier otro contenedor, en caso afirmativo, haga lo siguiente:
docker-compose down
-
Si la VPN está conectada, desconéctala e intenta de nuevo subir el contenedor docker:
docker-compose up -d container_name
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-06-01 05:57:37
Me encontré con el mismo problema, la razón por la que se alcanzó el máximo de redes:
Hacer un: docker network ls
Elija uno para eliminar usando: docker network rm networkname_default
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-25 10:41:18