SpiderClub / haipproxy

:sparkling_heart: High available distributed ip proxy pool, powerd by Scrapy and Redis
https://spiderclub.github.io/haipproxy/
MIT License
5.43k stars 913 forks source link

报个 Docker 部署异常 #37

Closed chawyehsu closed 6 years ago

chawyehsu commented 6 years ago
$ docker-compose.exe up
Removing haipproxy_haipproxy_1
haipproxy_splash_1 is up-to-date
haipproxy_redis_1 is up-to-date
Recreating b29055e49998_haipproxy_haipproxy_1 ... error

ERROR: for b29055e49998_haipproxy_haipproxy_1  Cannot start service haipproxy: b"error while creating mount source path '/host_mnt/c/Users/<omitted>/workspace/haipproxy': mkdir /host_mnt/c/Users/<omitted>/workspace: file exists"

ERROR: for haipproxy  Cannot start service haipproxy: b"error while creating mount source path '/host_mnt/c/Users/<omitted>/workspace/haipproxy': mkdir /host_mnt/c/Users/<omitted>/workspace: file exists"
ERROR: Encountered errors while bringing up the project.

修改 docker-compose.yml 注释掉如下2行后可用

version: "2.0"
services:
  redis:
    image: redis
    ports:
      - "6379:6379"
    command: >
      --requirepass 123456
  splash:
    image: scrapinghub/splash
    ports:
      - "8050:8050"
  haipproxy:
    image: registry.cn-hangzhou.aliyuncs.com/weakiwi/haipproxy-alpine-image:stable
    # volumes:            <----------
    #   - .:/haipproxy    <----------
    command: sh run.sh
    ports:
      - "3128:3128"
    links:
      - redis
      - splash
ResolveWang commented 6 years ago

感谢反馈,可能原因是windows和类Unix平台的路径表示有些不一致

Hotsunrize commented 6 years ago

这个Dockerfile里面我看见已经COPY当前目录到容器的/haipproxy了

PS F:\github\haipproxy> cat .\Dockerfile
FROM vaeum/alpine-python3-pip3

MAINTAINER ResolveWang <resolvewang@foxmail.com>

ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
RUN apk upgrade --no-cache \
  && apk add --no-cache \
  squid \
  libxml2-dev \
  libxml2 \
  libxslt-dev \
  libxslt \
  libffi-dev \
  python3-dev \
  && rm -rf /var/cache/* \
  && rm -rf /root/.cache/*
#RUN apt update
#RUN apt install squid -yq
RUN sed -i 's/http_access deny all/http_access allow all/g' /etc/squid/squid.conf && cp /etc/squid/squid.conf /etc/squid/squid.conf.backup
#RUN apt install python3 python3-pip -yq
#RUN which python3|xargs -i ln -s {} /usr/bin/python
#RUN which pip3|xargs -i ln -s {} /usr/bin/pip
COPY . /haipproxy
WORKDIR /haipproxy
RUN pip3 install --upgrade pip && pip3 install -i https://pypi.douban.com/simple/ -r requirements.txt
#CMD ['python3', 'crawler_booter.py', '--usage', 'crawler', 'common']

所以docker-compose.yml里面就可以注释掉,关键windows上挂volumes坑太多,老是提示权限不足,还是直接copy到容器里面省事(>:__:<)

 #volumes:
    #  - .:/haipproxy
chawyehsu commented 6 years ago

我建议 docker-compose 改成这样吧:https://github.com/h404bi/haipproxy/commit/685932e46f158d0656c58408a46517261b01a219