1.拉镜像
docker pull ubuntu
2. 启动容器
docker run -it --name ubuntu -v /dockershare:/dockershare --network=host docker.io/ubuntu:20.04
## 注意:进入ubuntu容器内部需要先执行apt update才能下载常用工具,但是apt update需要联网更新,所以要将容器网络设置与宿主机网络一致
3. ubuntu apt update 更新资源包
apt update
## 注意如果连不上ubuntu 内部网络 ,可将/etc/apt/source.list 里的 环境地址修改为国内阿里云的地址在这个文件下面添加
deb http://mirrors.aliyun.com/debian wheezy main contrib non-free
deb-src http://mirrors.aliyun.com/debian wheezy main contrib non-free
deb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free
deb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free
Docker环境下跑Ubuntu环境的构建