Set proxies for Docker

Firstly, set the proxies in Preference Panel.

proxy-1.JPG

Secondly, you need to add proxy info to your Dockerfile.txt like this,

bash-3.2$ cat Dockerfile
# Use an official Python runtime as a parent image
FROM python:2.7-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt –proxy http://www-xxxxx.com:80 –trusted-host pypi.python.org

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV NAME World

# Run app.py when the container launches
CMD [“python”, “app.py”]

Thirdly, if you are going to run docker-machine command to create VM. You will have to set below so it can download related stuff.

export https_proxy=htp://www-proxy.xxx:80