剛開始走了彎路,按照網絡上的教程一步步安裝docker
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install docker-ce
docker run hello-world
這時一直出現這個錯誤
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
網絡上說是docker沒啟,按照網絡上的操作步驟執行了,還是報錯,百度上大多數答案都是類似的,后來到bing上看了國外網友的回答,才知道win10下的ubuntu子系統比較特殊,必須要先安裝window版的docker,同時設置
image.png
同時設置
powershell中
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
然后問題解決