Can't install pip packages inside a docker container with Ubuntu

前端 未结 16 2343
抹茶落季
抹茶落季 2020-11-30 19:07

I\'m following the fig guide to using docker with a python application, but when docker gets up to the command

RUN pip install -r requirements.txt

16条回答
  •  隐瞒了意图╮
    2020-11-30 19:41

    As a Docker newbie, I had a problem that manifested itself in this way when I was following the tutorial for Docker at:

    https://docs.docker.com/get-started/part2

    I'm using Docker 17.03.1-ce on a corporate LAN.

    I checked and double checked my DNS settings. I'd used various ways of configuring the DNS that I'd found in my searches across the Internet. Some caused errors on startup. The approach that I ultimately settled upon for configuring the DNS was the one in the Troubleshoot Linux section of the above link above where the DNS is configured via the daemon.json file in the /etc/docker directory.

    However, I still had this same issue. What finally solved the problem for me was the configuration of the proxy via the http_proxy and https_proxy environment variables. I had them specified in my Dockerfile, but I neglected to do so before the RUN pip command.

    Even though it appeared to be a DNS issue, moving these ENV commands ahead of the RUN command made the difference for me. In case that is helpful for anyone with this problem.

提交回复
热议问题