1

I am trying to create a simple docker image in AWS EC2.

I have the following Dockerfile.

FROM node:12-alpine

RUN apk add --no-cache build-base gcc autoconf automake libtool zlib-dev libpng-dev nasm

RUN mkdir -p /home/project/website/node_modules && chown -R node:node /home/project/website

WORKDIR /home/project/website

COPY /package*.json ./

USER node

RUN npm cache verify

RUN npm install

COPY --chown=node:node . .

RUN chmod +x wait-for.sh

RUN chmod -R 0755 /home/project/website/src/views/

EXPOSE 8000

when I try to build by this following command docker-compose build

I got the following output

Step 2/12 : RUN apk add --no-cache build-base gcc autoconf automake libtool zlib-dev libpng-dev nasm
 ---> Running in 208f43729d68
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz: network error (check Internet connection and firewall)
  autoconf (missing):
    required by: world[autoconf]
  automake (missing):
    required by: world[automake]
  build-base (missing):
    required by: world[build-base]
  gcc (missing):
    required by: world[gcc]
  libpng-dev (missing):
    required by: world[libpng-dev]
  libtool (missing):
    required by: world[libtool]
  nasm (missing):
    required by: world[nasm]
  zlib-dev (missing):
    required by: world[zlib-dev]
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz: network error (check Internet connection and firewall)
ERROR: unsatisfiable constraints:

and I have already created it for the first time and everything was running successful, but I have changed some paths on my docker file and I have removed all containers, images, volumes... but this time I got this error.

Nouh Belahcen
  • 774
  • 1
  • 11
  • 36
  • Try docker build with `--network host` flag. Refer to docs at : https://docs.docker.com/network/host/ . If your host is behind a proxy server, then you need to add proxy server in the docker build command. – Amit kumar Sep 27 '20 at 15:16

1 Answers1

0

I solved the problem by the following commands

pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d

Here is the original answer

My docker container has no internet

Nouh Belahcen
  • 774
  • 1
  • 11
  • 36