安装minikube过程中涉及的一些问题

安装minikube过程中涉及的一些问题

更换Apt-get 更新源

准备好一个sources.list,如果在制作docker镜像时,拷贝到镜像/etc/apt/目录下面

RUN mkdir /conf && mkdir /code
ADD ./sources.list /conf
ADD ./service.py /code

RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && mv /conf/sources.list /etc/apt/. && apt-get update && apt-get -q install -y curl python3-pip bash

国内推荐使用清华的源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

替换更新源之后,需要执行命令

sudo apt-get update

Ubuntu中安装Docker

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
 
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
 
$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

 $ sudo apt-get update
 
 $ sudo apt-get install docker-ce docker-ce-cli containerd.io

Run Docker with no-root User

$ sudo groupadd docker

$ sudo usermod -aG docker $USER

登出再登入账号使得修改生效

安装minikube

# 使用代理
export http_proxy=http://10.15.135.20:8080
export https_proxy=http://10.15.135.20:8080
export no_proxy=localhost,127.0.0.1,192.168.0.0/16,172.18.0.0/16,172.17.0.0/16

# 下载 & 安装
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb

$ sudo dpkg -i minikube_latest_amd64.deb

# 启动
$ minikube start

使用Proxy下载Docker Image

  1. 修改配置文件
sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf
  1. 增加配置
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80"
Environment="HTTPS_PROXY=https://proxy.example.com:443"
Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
  1. 重载配置,重启Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
  1. 验证配置成功
sudo systemctl show --property=Environment docker

Docker中使用代理下载apt-get

ENV http_proxy http://10.21.142.20:8080
ENV https_proxy http://10.21.142.20:8080

pip使用代理安装Python模块

pip3 install flask --proxy http://10.21.142.20:8080

你可能感兴趣的:(安装minikube过程中涉及的一些问题)