当前位置:   article > 正文

Ubuntu 18.04/20.04 部署minikube_e: package 'docker-ce' has no installation candida

e: package 'docker-ce' has no installation candidate

1、参考文档

官方文档
minikube start

参考使用国内源文档

Minikube - Kubernetes本地实验环境

使用minikube安装单机版Kubernetes

2、 安装 Docker

Install Docker Engine on Ubuntu

自行配置镜像加速

按照以上官网安装遇到错误

$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'docker-ce' has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn't find any package by glob 'containerd.io'
E: Couldn't find any package by regex 'containerd.io'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

干脆,改用 apt 安装

$ docker -v

Command 'docker' not found, but can be installed with:

sudo snap install docker     # version 20.10.8, or
sudo apt  install docker.io

See 'snap info docker' for additional versions.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

说明:apt 安装的是 docker.io ,不是 docker-ce

docker-ce 是 docker 官方维护的
docker.io 是 Debian 团队维护的
docker.io 采用 apt 的方式管理依赖
docker-ce 用 go 的方式管理依赖,会自己管理所有的依赖。
  • 1
  • 2
  • 3
  • 4

配置阿里云镜像加速器

镜像加速器

记得重启服务

sudo systemctl daemon-reload
sudo systemctl restart docker

3、配置Kubernetes软件源

阿里云Kubernetes 镜像

以上阿里云Kubernetest镜像的方法缺少 sudo 和 kubernetes.list 不太对!

$ sudo apt-get install -y apt-transport-https

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-151 linux-headers-4.15.0-151-generic linux-headers-4.15.0-158 linux-headers-4.15.0-158-generic linux-image-4.15.0-151-generic linux-image-4.15.0-158-generic
  linux-modules-4.15.0-151-generic linux-modules-4.15.0-158-generic linux-modules-extra-4.15.0-151-generic linux-modules-extra-4.15.0-158-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 85 not upgraded.
Need to get 4,348 B of archives.
After this operation, 154 kB of additional disk space will be used.
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe amd64 apt-transport-https all 1.6.14 [4,348 B]
Fetched 4,348 B in 1s (3,692 B/s)                                   
Selecting previously unselected package apt-transport-https.
(Reading database ... 186525 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.14_all.deb ...
Unpacking apt-transport-https (1.6.14) ...
Setting up apt-transport-https (1.6.14) ...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

$ sudo curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add -

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2537  100  2537    0     0  10659      0 --:--:-- --:--:-- --:--:-- 10659
OK
  • 1
  • 2
  • 3
  • 4

加入到 apt 源

sudo tee /etc/apt/sources.list.d/kubernetes.list <<-'EOF'
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
  • 1
  • 2
  • 3

$ sudo apt-get update

$ sudo apt-get install -y kubectl

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-151 linux-headers-4.15.0-151-generic linux-headers-4.15.0-158 linux-headers-4.15.0-158-generic linux-image-4.15.0-151-generic linux-image-4.15.0-158-generic
  linux-modules-4.15.0-151-generic linux-modules-4.15.0-158-generic linux-modules-extra-4.15.0-151-generic linux-modules-extra-4.15.0-158-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  kubectl
0 upgraded, 1 newly installed, 0 to remove and 85 not upgraded.
Need to get 9,057 kB of archives.
After this operation, 46.9 MB of additional disk space will be used.
Get:1 https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial/main amd64 kubectl amd64 1.22.4-00 [9,057 kB]
Fetched 9,057 kB in 3s (3,516 kB/s)  
Selecting previously unselected package kubectl.
(Reading database ... 186529 files and directories currently installed.)
Preparing to unpack .../kubectl_1.22.4-00_amd64.deb ...
Unpacking kubectl (1.22.4-00) ...
Setting up kubectl (1.22.4-00) ...
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

4、安装并启动minikube

  1. 按照官方文档组合出来的命令·

     curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
    
    • 1

    安装
    sudo install minikube-linux-amd64 /usr/local/bin/minikube

  2. 启动
    $ minikube start --image-mirror-country=‘cn’

     
    声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/830652
推荐阅读
相关标签