1. 虚拟机linux环境
- 下载VNware
https://zhuanlan.zhihu.com/p/41940739
https://zhuanlan.zhihu.com/p/141033713
参考此2篇文章安装 - 安装Ubuntu。
- 安装docker
https://www.runoob.com/docker/ubuntu-docker-install.html
2. 树莓派linux
前面在虚拟机上搞得,不是很好操作。下面开始在树莓派上搞。
- 开启树莓派ssh, raspi-config。 facing-setting, ssh。
- 按照docker官网教程安装docker。https://docs.docker.com/engine/install/debian/
- 树莓派配置国内源。https://zhuanlan.zhihu.com/p/98079246
- docker使用国内源。https://www.runoob.com/docker/ubuntu-docker-install.html
树莓派版本的docker切换源。https://blog.csdn.net/qq_29753285/article/details/95094788
2.1卸载docker
sudo apt-get remove docker docker-engine docker.io containerd runc
1, 更新linux
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
2,Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
这里改阿里源
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo apt-key add -
3.Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels.
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
修改后的
sudo echo \
"deb [arch=armhf] http://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
注意这里的armhf。https://www.codenong.com/37790029/
3. Install Docker Engine
1.Update
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
二、使用国内镜像
修改/etc/docker/daemon.json,添加如下配置:
sudo vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}
然后执行命令systemctl restart docker重启docker
4. 测试
1.输出version:
docker --version
2. docker run hello-world 权限不足
添加权限:https://blog.csdn.net/weixin_47758362/article/details/108050348
sudo gpasswd -a username docker #将普通用户username加入到docker组
环境配置完成。
linux几个命令:
usermod -a -G sudo test
usermod -a -G adm test
上面这个代码的意思是,把test用户添加到sudo和admin用户组里面。这里要注意的是系统里面的admin的用户组的名字是"adm"。
groups test
上面这个命令的意思是检查test所在的用户组