Docker Community Forums

Share and learn in the Docker community.

Apt-get not working behind firewall even setting Fiddler as a tunnel

docker
beta

(Julianonunes) #1

I’m trying to run docker-compose up -d with my files like this:

FROM ruby:2.3.1

MAINTAINER Juliano Nunes


RUN mkdir /var/www
WORKDIR /var/www

ADD Gemfile /var/www/Gemfile
ADD Gemfile.lock /var/www/Gemfile.lock
RUN bundle install --verbose
ADD . /var/www

And:

version: '2'

services:
  web:
    build: 
      context: .
      dockerfile: .docker/rails.dockerfile
    command: bash -c 'rm -f tmp/pids/server.pid && bundle install && bundle exec rails s -b "0.0.0.0"'
    volumes: 
      - d:/OneDrive/Projetos/ddoc/web:/var/www
    ports: 
      - "3000:3000"
    depends_on:
      - 'db'
    networks:
      - ddoc-network
    environment:
      http_proxy: 10.0.75.1:7777
      http_proxy: 10.0.75.1:7777
      

  db:
    image: mysql
    networks:
      - ddoc-network
    volumes:
      - d:/Docker/PersistedStorage/ddoc:/var/lib/mysql
    ports:
      - "3306:3306" 
    environment:
      MYSQL_ROOT_PASSWORD: P@ssw0rd


networks:
  ddoc-network:
    driver: bridge

Docker was able to download the images (I’ve set the proxy to 127.0.0.1:7777 on Docker systray app), however the connection is being refused from inside the container:

PS D:\OneDrive\Projetos\ddoc\web> dc build web
Building web
Step 1 : FROM ruby:2.3.1
 ---> e4b689e9dc8b
Step 2 : MAINTAINER Juliano Nunes
 ---> Using cache
 ---> 3f5e19bcd598
Step 3 : RUN mkdir /var/www
 ---> Using cache
 ---> 774f5ffad594
Step 4 : WORKDIR /var/www
 ---> Using cache
 ---> 3cc7fd890480
Step 5 : ADD Gemfile /var/www/Gemfile
 ---> Using cache
 ---> 9b470931336a
Step 6 : ADD Gemfile.lock /var/www/Gemfile.lock
 ---> Using cache
 ---> 0d8d0529a8fc
Step 7 : RUN bundle install --verbose
 ---> Running in b3470dcc7802
HTTP GET https://index.rubygems.org/versions
SocketError: Failed to open TCP connection to index.rubygems.org:443 (getaddrinfo: Name or service not known)
/usr/local/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
  /usr/local/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
  /usr/local/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
  /usr/local/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
  /usr/local/lib/ruby/2.3.0/net/http.rb:878:in `connect'
  /usr/local/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
  /usr/local/lib/ruby/2.3.0/net/http.rb:858:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/net/http/persistent.rb:700:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/net/http/persistent.rb:631:in `connection_for'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/net/http/persistent.rb:994:in `request'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/downloader.rb:48:in `request'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/downloader.rb:16:in `fetch'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:81:in `block in compact_index_client'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:42
:in `block in update'
  /usr/local/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29
:in `update'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:64:in `upd
ate'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:55:in `upd
ate_and_parse_checksums!'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:65:in `available?'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:15:in `call'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher.rb:154:in `use_api'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:331:in `block in api_fetchers'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:331:in `select'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:331:in `api_fetchers'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:336:in `block in remote_specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/index.rb:10:in `build'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:335:in `remote_specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:82:in `specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/lazy_specification.rb:56:in `__materialize__'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:91:in `block in materialize'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `map!'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `materialize'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:129:in `resolve_remotely!'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer.rb:195:in `resolve_if_need'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer.rb:70:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer.rb:22:in `install'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/install.rb:102:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:175:in `install'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
  /usr/local/bin/bundle:22:in `load'
  /usr/local/bin/bundle:22:in `<main>'
Bundler::HTTPError: Network error while fetching https://index.rubygems.org/versions
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/downloader.rb:61:in `rescue in request'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/downloader.rb:41:in `request'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/downloader.rb:16:in `fetch'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:81:in `block in compact_index_client'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:42
:in `block in update'
  /usr/local/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29
:in `update'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:64:in `upd
ate'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:55:in `upd
ate_and_parse_checksums!'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:65:in `available?'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:15:in `call'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/fetcher.rb:154:in `use_api'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:331:in `block in api_fetchers'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:331:in `select'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:331:in `api_fetchers'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:336:in `block in remote_specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/index.rb:10:in `build'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:335:in `remote_specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:82:in `specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/lazy_specification.rb:56:in `__materialize__'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:91:in `block in materialize'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `map!'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `materialize'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:129:in `resolve_remotely!'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer.rb:195:in `resolve_if_need'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer.rb:70:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer.rb:22:in `install'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/install.rb:102:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:175:in `install'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
  /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
  /usr/local/bin/bundle:22:in `load'
  /usr/local/bin/bundle:22:in `<main>'

I’ve tried setting the DNS of DockerNAT to 8.8.8.8 and got the same result.

What else do I have to do to make it work? Do I need to enable Internet Connection Sharing or bridge LAN with DockerNAT?

UPDATE

One additional information: if I exec the ruby image using Kitematic, the http_proxy and https_proxy variables are not set, but if I set them using export command to http://10.0.75.1:7777, the apt-get update starts working.

If I open bash in a container executed via Docker Compose, the enviroment variable is already set, however the apt-get update does not work.