티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

Docker "ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network"

도커 "오류: 네트워크에 할당할 기본값 중 중복되지 않는 사용 가능한 IPv4 주소 풀을 찾을 수 없습니다."

 문제 내용 

I have a directory apkmirror-scraper-compose with the following structure:

나는 다음과 같은 구조를 가진 apkmirror-scraper-compose 디렉토리를 가지고 있다:

 

.
├── docker-compose.yml
├── privoxy
│   ├── config
│   └── Dockerfile
├── scraper
│   ├── Dockerfile
│   ├── newnym.py
│   └── requirements.txt
└── tor
    └── Dockerfile

I'm trying to run the following docker-compose.yml:

다음 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

where the Dockerfile for tor is

여기서 tor의 도커 파일은

 

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"]

that for privoxy is

privoxy에 대한 것이다.

 

FROM alpine:latest
EXPOSE 8118
RUN apk --update add privoxy
COPY config /etc/privoxy/config
CMD ["privoxy", "--no-daemon"]

where config consists of the two lines

여기서 config는 두 줄로 구성됩니다.

 

listen-address 0.0.0.0:8118
forward-socks5 / tor:9050 .

and the Dockerfile for scraper is

스크레이퍼용 도커 파일은

 

FROM python:2.7-alpine
ADD . /scraper
WORKDIR /scraper
RUN pip install -r requirements.txt
CMD ["python", "newnym.py"]

where requirements.txt contains the single line requests. Finally, the program newnym.py is designed to simply test whether changing the IP address using Tor is working:

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)))

The docker-compose build builds successfully, but if I try docker-compose up, I get the following error message:

docker-compose 빌드는 성공적으로 빌드되지만 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

I tried searching for help on this error message, but couldn't find any. What is causing this error?

이 오류 메시지에 대한 도움말을 검색했지만 찾을 수 없습니다. 이 오류의 원인은 무엇입니까?

 

 

 

 높은 점수를 받은 Solution 

I've seen it suggested docker may be at its maximum of created networks. The command docker network prune can be used to remove all networks not used by at least one container.

도커가 생성된 네트워크의 최대치에 도달할 수 있음을 시사하는 것을 보았습니다. docker network prune 명령을 사용하여 하나 이상의 컨테이너에서 사용하지 않는 모든 네트워크를 제거할 수 있습니다.

 

My issue ended up being, as Robert commented about: an issue with openvpn service openvpn stop 'solved' the problem.

로버트가 언급했듯이, 제 문제는 결국 openvpn service openvpn stop의 문제가 문제를 '해결'했다는 것입니다.

 

 

 

 가장 최근 달린 Solution 

I had this error when a VPN was running on my system. As soon as I disconnected the VPN, docker was up and running.

시스템에서 VPN이 실행 중일 때 이 오류가 발생했습니다. VPN 연결을 끊자마자 도커가 작동하고 있었습니다.

 

 

 

출처 : https://stackoverflow.com/questions/43720339/docker-error-could-not-find-an-available-non-overlapping-ipv4-address-pool-am

반응형
댓글
공지사항
최근에 올라온 글