镜像内安装包失败处理

方法一:修改Dockerfile,在Dockerfile中增加如下

ubuntu示例

text
1
2
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list

apline示例

text
1
RUN sed -i 's@http://dl-cdn.alpinelinux.org/@https://mirrors.aliyun.com/@g' /etc/apk/repositories

方法二:使用http代理,

ubuntu 参考 命令行使用代理

下载镜像失败处理

方法一:docker宿主机使用ss,开启局域网可连接。同局域网中的都可直接连此代理 方法二: docker systemd的 service文件中增加http代理

可看到已经可以成功运行envoy example示例

cannot bind ‘0.0.0.0:80’: Permission denied

docker-compose文件

yaml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
version: '3'
services:
  envoy:
    image: envoyproxy/envoy-alpine:v1.15-latest
    volumes:
    - ./envoy.yaml:/etc/envoy/envoy.yaml
    network_mode: "service:mainserver" 
    depends_on:
    - mainserver
  mainserver:
    image: cylonchau/envoy-end:latest
    networks:
      envoymesh:
        aliases:
        - webserver
        - httpserver
        - envoy_end
networks:
  envoymesh: {}

启动时报错

text
1
2
3
4
envoy_1       | [2020-09-06 07:09:48.618][8][critical][main] [source/server/server.cc:101] error initializing configuration '/etc/envoy/envoy.yaml': cannot bind '0.0.0.0:80': Permission denied
envoy_1       | [2020-09-06 07:09:48.618][8][info][main] [source/server/server.cc:704] exiting
envoy_1       | cannot bind '0.0.0.0:80': Permission denied
root_envoy_1 exited with code 1

参考 list

text
1
2
environment:
- "ENVOY_UID=0"