代码之家  ›  专栏  ›  技术社区  ›  Homewrecker

无法从容器内部连接到内部网络

  •  0
  • Homewrecker  · 技术社区  · 6 年前

    我有以下文件:

    FROM node:8
    WORKDIR /tmp
    COPY package.json /tmp/
    RUN npm config set registry http://xxx:8081/repository/npm-group/
    RUN npm install
    
    WORKDIR /opt/app
    COPY . /opt/app/
    RUN cp -a /tmp/node_modules /opt/app/
    
    EXPOSE 3000
    
    ENTRYPOINT [ "npm", "start" ]
    

    当我尝试使用以下方法构建图像时:

    docker build -t blah .
    

    在我进入步骤5/10,NPM安装之前,一切都很顺利。日志显示:

    npm ERR! errno ETIMEDOUT
    npm ERR! network request to http://xxx:8081/repository/npm-group/prop-types failed, reason: connect ETIMEDOUT x.x.x.x:8081
    

    我不知道发生了什么。Nexus存储库托管在内部网络上,所以我不知道为什么不能联系它。

    iptables显示以下内容:

    philippe@laptop:~/localdev/react-starterkit$ sudo iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    DOCKER-USER  all  --  anywhere             anywhere            
    DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere             ctstate  RELATED,ESTABLISHED
    DOCKER     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere            
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain DOCKER (1 references)
    target     prot opt source               destination         
    
    Chain DOCKER-ISOLATION-STAGE-1 (1 references)
    target     prot opt source               destination         
    DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
    RETURN     all  --  anywhere             anywhere            
    
    Chain DOCKER-ISOLATION-STAGE-2 (1 references)
    target     prot opt source               destination         
    DROP       all  --  anywhere             anywhere            
    RETURN     all  --  anywhere             anywhere            
    
    Chain DOCKER-USER (1 references)
    target     prot opt source               destination         
    RETURN     all  --  anywhere             anywhere            
    

    有什么想法吗?

    1 回复  |  直到 6 年前