Hello all, I am sorry if this question is too basic since I am new to networking on docker.
So I have an offline ubuntu device that I want to use as a server. The device cannot connect directly to the internet, but we can use proxy to get temporary connection for some task such as installing application and other. It works fine, for apt or python pip, but when I try to use the proxy within docker container, it is refused to connect.
I had an image that I build with the same machine but with internet, then I load the image to my offline device to be used. To run the container with the said image, it need to connect to the internet (to install some python packages), how can I tell my container to use the proxy?
I tried to use it as an environment arguments on the run
docker run -it -p 4000:3000 -e https_proxy=credential@host myimage:latest
but still have error
Collecting package metadata (repodata.json): / ERROR:bridge.app:HTTPSConnectionPool(host='api.mixpanel.com', port=443): Max retries exceeded with url: /track (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f15c7d80820>: Failed to establish a new connection: [Errno 113] No route to host')))
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/opt/conda/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host
Do you have any recommendation that I can do? Because my server should not connect directly to the internet?
Thank you for your input and answer. I really appreciate any input