搭建Docker需要先安装Debian,请查看 随身WiFi棒子刷入Debian系统完美教程
安装Docker,以root用户登录
用终端软件putty登录棒子
更换Debian软件源
先安装vim编辑器
apt-get install vim
再一键执行以下命令
echo -e '\n\n\n\n\n\n\n\n\n\n####################################\n' rm /etc/apt/sources.list touch /etc/apt/sources.list echo -e "# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释\n\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free\n# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free\n\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free\n# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free\n\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free\n# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free\n\ndeb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free\n# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" >> /etc/apt/sources.list echo -e '1、默认软件源修改完成!\n\n' sed -i '1c deb http://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb buster main' /etc/apt/sources.list.d/AdoptOpenJDK.list gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 843C48A565F8F04B gpg --armor --export 843C48A565F8F04B | apt-key add - echo -e '\n\n2、AdoptOpenJDK报错修复完成!\n\n' sed -i '1c #deb http://repo.mobian-project.org/ bullseye main non-free' /etc/apt/sources.list.d/mobian.list echo -e '3、Mobian源报错已屏蔽!' echo -e '\n\n####################################\n\n即将开始更新软件源list......\n' sleep 2 apt-get update echo -e '\n\n4、更新软件源list更新完成!' echo -e '\n\n####################################\n\n即将开始升级系统程序至最新版......' sleep 2 apt-mark hold openssh-server apt-get -y upgrade apt-mark unhold openssh-server echo -e '\n\n5、系统程序更新完成!\n\n####################################\n\n\n\n'
安装docker及管理面板
更新源:
apt-get update
安装工具:
apt-get install curl wget apt-transport-https ca-certificates gnupg2 software-properties-common
添加 Docker 的官方 GPG 密钥:
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | apt-key add -
自动安装docker:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun 或者使用国内 daocloud 一键安装命令,二选一 curl -sSL https://get.daocloud.io/docker | sh
docker切换为国内源:(没有的话可以自己新建一个 /etc/docker/daemon.json )
echo '{"registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com"]}' > /etc/docker/daemon.json
查看下是否添加成功,成功会有一行源的信息
cat /etc/docker/daemon.json
更新下配置并且重启:
#开机自启动docker systemctl enable docker #手动启动docker systemctl start docker #重启棒子 reboot
重启后再次连接ssh,查看当前的docker安装状态
docker version
安装面板:
docker run -d \ --name FAST_OS_DOCKER \ --restart always \ -p 8081:8081 \ -p 8082:8082 \ -e TZ="Asia/Shanghai" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /etc/docker/:/etc/docker/ \ wangbinxingkong/fast:latest
安装好之后,访问地址进入系统:
http://服务器IP地址或域名:8081
初始登录名和密码为:
登录名:admin
密码:888888/123456
docker服务的命令
#启动: systemctl start docker #守护进程重启: systemctl daemon-reload #重启docker服务: systemctl restart docker / service docker restart #关闭: docker service docker stop / docker systemctl stop docker
记录一些坑:
1、安装面板时报错 Unable to find image 'wangbinxing:latest' locally 解决方法
首先创建deamon.json文件用来保存源
mkdir /etc/docker/ vim /etc/docker/daemon.json
添加稳定而且不经常变动的镜像源,这里选择中科大的源
{ "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] }
重启一下docker就可以了
systemctl status docker
2、如果证书问题,下载对应证书,下面的代码后面的B53DC80D13EDEF05换上报错的对应编号。
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv B53DC80D13EDEF05
3、关于换源,有时候报/etc/apt/sources.list.d/docker.list,把里面的改成下面的
deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/kubernetes/apt/ kubernetes-xenial stable main
4、更换系统软件源为国内源
打开WinSCP软件并登录,根据路径打开文件/etc/apt/sources.list文件,把里面的都删掉,下面的代码全部复制粘贴进去并保存
#http://mirrors.163.com/debian/为软件源也可以为其他的 bullseye为版本代号 main non-free contrib区别如下 deb http://mirrors.163.com/debian/ bullseye main non-free contrib deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib #deb http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib #deb http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib #deb-src http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib #deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
相关教程