网上找了很多办法,如下方法测试有效
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/intranet | sh -
然后会提示安装成功,
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker ipsg
Remember that you will have to log out and back in for this to take effect!
根据提示,当前用户添加到docker组。、
注销重新登录,测试docker是否安装成功:
docker run hello-world
测试报错:
Unable to find image 'hello-world ' locally ...
解决办法:
(1)、修改/etc/docker/daemon.json 文件
//1)在/etc/docker文件夹下执行:
sudo touch daemon.json
//2)修改/etc/docker/daemon.json 文件权限
chmod 777 daemon.json
//3)daemon.json文件中写入如下内容:
------------------
{
"registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com"]
}
(2)、重启docker之后就可以了
//重启docker
sudo systemctl restart docker
//查看状态
sudo systemctl status docker
(3)再次运行测试
docker run hello-world
提示如下:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:e7c70bb24b462baa86c102610182e3efcb12a04854e8c582838d92970a09f323
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
能够正常使用!