I'm trying to create Docker container where I need to use apt-get install command. Currently it looks like this:
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
build-essential \
cmake
Unfortunately, when I try to build it I'm getting some errors regarding proxy. I am working behind corporate proxy and I'd like my container to work well in such conditions.
I did some reading online and I tired few options:
Option 1
FROM ubuntu:18.04
ENV http_proxy <HTTP_PROXY>
ENV https_proxy <HTTPS_PROXY>
RUN apt-get update && apt-get upgrade
https://stackoverflow.com/a/22184601
Option 2
FROM ubuntu:18.04
ENV http_proxy 'http://corporate_proxy:port'
ENV https_proxy 'http://corporate_proxy:port'
https://stackoverflow.com/a/30252882
Option 3
docker build --build-arg http_proxy=$http_proxy
--build-arg https_proxy=$https_proxy -t mytest_docker .
Based on https://elegantinfrastructure.com/docker/ultimate-guide-to-docker-http-proxy-configuration/
However, none of this options is working and I'm getting always same error:
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'corporate_proxy'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'corporate_proxy'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'corporate_proxy'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Temporary failure resolving 'corporate_proxy'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'corporate_proxy'
corporate_proxy is just a placeholder for actual (working) proxy.
I am sure that the proxy address is correct and is working on host system because I can normally download everything. The problem is only with this docker image.
Any suggestion how I can resolve that?
EDIT #1
Based on the answer from @Raoslaw Szamszur I did a bit more debugging. Unfortunately results are still the same.
I have added values to config.json file and restarted daemon. Next I tried one more time doing all of my options with same outcome.
Also I wanted to run just Ubuntu docker using following line:
docker run --name ubunut -it -p <port_http>:<port_http> -p <port_https>:<port_https> ubuntu:18.04
Once it was running apt-get is unable to download anything printing same kind of error as previously.
Also this is how this container looked in list
docker container ls --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e6fdeaec3ad9 ubuntu:18.04 "/bin/bash" 3 minutes ago Up 3 minutes 0.0.0.0:<http_port>-<https_port>-><http_port>-<https_port>/tcp ubunut