非必选-多平台兼容
可以使用QEMU来实现x86机器上运行arm容器。主要参考multiarch/qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
拉取镜像
docker pull ubuntu- 运行容器
docker run --name iubuntu -t -i -d -p 3316:22 ubuntu - 进入容器shell docker exec -t -i iubuntu /bin/bash
更新源地址
- 更新
apt-get update - 先下载nano
apt install nano - 更新/etc/apt/sources.list。注意这里使用的是debian bullseye, 更多的可以去[清华大学镜像源](清华大学开源软件镜像站 | Tsinghua Open Source Mirror)看看
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
- 更新
apt-get update
开启sshd
- apt-get install -y openssh-client
- apt-get install -y openssh-server
- 修改密码
passwd root - 允许密码登入
nano /etc/ssh/sshd_config修改PermitRootLogin yes - 重启一下docker 容器
- 启动sshd
service ssh start
安装python
- 安装依赖
apt install curl build-essential libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev ccache curl -O https://mirrors.huaweicloud.com/python/3.8.10/Python-3.8.10.tar.xztar -xvf Python-3.8.10.tar.xzcd Python-3.8.10./configure --prefix=/usr/local/python3make && make install- 建立连接
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python && ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip - 设定一下国内源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
pip config set install.trusted-host mirrors.aliyun.com