0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Dockerのビルド時のproxyエラー

Posted at

結論

# Dockerfile
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1

# -----ここから

# プロキシ設定をクリア
ENV http_proxy=""
ENV https_proxy=""
ENV HTTP_PROXY=""
ENV HTTPS_PROXY=""
ENV no_proxy="*"

# -----ここまで

WORKDIR /src

RUN apt-get update && apt-get install -y make

RUN pip install poetry

COPY pyproject.toml* poetry.lock* ./

RUN poetry config virtualenvs.in-project true
RUN if [ -f pyproject.toml ]; then poetry install --no-root; fi


ENTRYPOINT ["poetry", "run", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--reload"]

docker-compose.yml
services:
  demo-app:
    build: 
      context: .
      dockerfile: Dockerfile
      # ------ここから
      args:
        - http_proxy=
        - https_proxy=
        - HTTP_PROXY=
        - HTTPS_PROXY=
    dns:
      - 8.8.8.8
      - 1.1.1.1
    environment:
      http_proxy: ""
      https_proxy: ""
      HTTP_PROXY: ""
      HTTPS_PROXY: ""
      no_proxy: "*"
    # -------ここまで
    volumes:
      - .dockervenv:/src/.venv
      - .:/src
    ports:
      - 8000:8000

この記事で対象範囲

  • 家のwifi(ローカル環境)で作業をしているのにproxyエラーが出る場合の対処法
  • ネットワークのproxy設定をしていないのに、proxyエラーが出る場合の対処法
  • dockerのproxy設定もしていないのに、proxyエラーが出る場合の対処法

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?