本文主要介绍 openmediavault安装配置docker和portainer的过程,portainer是docker镜像。
进入系统
-OMV-Extras
,安装docker,这里多半是不能成功的,需要命令行安装。
参考清华大学开源软件镜像站-Docker Community Edition 镜像使用帮助
如果你过去安装过 docker,先删掉:
sudo apt-get remove docker docker-engine docker.io
首先安装依赖:
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
根据你的发行版,下面的内容有所不同。我使用的发行版是Debian。
信任 Docker 的 GPG 公钥:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
注意根据硬件架构添加软件仓库,我的是arm架构。
添加软件仓库:
echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
最后安装:
sudo apt-get update
sudo apt-get install docker-ce
修改国内源:
编辑或新建配置文件/etc/docker/daemon.json
,记得加上dns,加上dns的原因参考:①Docker容器中的/etc/resolv.conf与宿主机不一致,配置dns的几种方式;②Docker容器修改dns;
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"dns" : ["114.114.114.114","8.8.8.8"]
}
第2步安装完,开始安装portainer,通过omv-extras也无法直接安装,不过根据我的情况,添加dns解析后,再进入omv-extras中直接点击安装即可。
可以先测试下遇到的问题是否和我一样,再决定是否按照接下来的操作。
命令行运行:
docker search portainer
如果输出是:
Error response from daemon: Get "https://index.docker.io/v1/search?q=portainer&n=25": dial tcp: lookup index.docker.io: device or resource busy
或
Error response from daemon: Get "https://index.docker.io/v1/search?q=portainer&n=25": dial tcp: lookup index.docker.io: no such host
就在/etc/resolv.conf
文件末尾添加dns解析:
nameserver 127.0.0.1
nameserver 114.114.114.114
nameserver 8.8.8.8
然后再次运行:
docker search portainer
输出是:
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
portainer/portainer This Repo is now deprecated, use portainer/p… 2192
portainer/portainer-ce Portainer CE - a lightweight service deliver… 1053
portainer/agent An agent used to manage all the resources in… 142
portainer/templates App Templates for Portainer http://portainer… 24
portainer/portainer-ee Portainer BE - a fully featured service deli… 16
portainer/portainer-k8s-beta Portainer for Kubernetes BETA 5
portainer/golang-builder Utility to build Golang binaries. 5 [OK]
portainer/volume-browser Experimental app used to browser the content… 4
portainer/dev-toolkit The entire Portainer development stack insid… 2
portainer/base Multi-stage build image to create the Portai… 2 [OK]
portainer/authenticator Helps you use the Docker CLI with the Portai… 1
rancher/portainer-agent 1
portainer/gosec 1
portainer/helper-reset-password 1
portainer/agent-k8s-beta Portainer for Kubernetes BETA (agent) 1
portainer/docbuilder Portainer.io documentation builder 1
portainer/portable-env 0
portainer/integration-starter 0
portainer/pri-fidoiot Docker images for the FIDO Device Onboard (F… 0
portainer/helper-templates A container helper for template file operati… 0
portainer/angular-builder Builder image for Portainer frontend. 0 [OK]
portainer/kubectl-shell 0
portainer/kube-tools Image including Docker, kubectl and kind 0
portainer/portainer-docker-extension 0
portainer/open-amt-cloud-toolkit-postgres 0