在Ubuntu系统下获取Docker镜像主要有以下几种方法:
docker pull ubuntu:20.04
ubuntu:20.04
指定了镜像的名称和标签,其中ubuntu
是镜像名,20.04
是标签,表示Ubuntu 20.04版本。/etc/docker/daemon.json
文件,添加国内镜像源。sudo vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://mirrors.ustc.edu.cn"]
}
sudo systemctl restart docker
docker save -o ubuntu_20.04.tar ubuntu:20.04
docker load -i ubuntu_20.04.tar
docker build -t my_ubuntu_image .
docker run -it --name my_ubuntu my_ubuntu_image
以上就是在Ubuntu系统下获取Docker镜像的几种方法,您可以根据自己的需求选择合适的方式。