![如何在 Windows 上的 Ubuntu 16.04 上安装 Docker-CE 并使其正常运行?](https://linux22.com/image/1592609/%E5%A6%82%E4%BD%95%E5%9C%A8%20Windows%20%E4%B8%8A%E7%9A%84%20Ubuntu%2016.04%20%E4%B8%8A%E5%AE%89%E8%A3%85%20Docker-CE%20%E5%B9%B6%E4%BD%BF%E5%85%B6%E6%AD%A3%E5%B8%B8%E8%BF%90%E8%A1%8C%EF%BC%9F.png)
不确定是否有人遇到过这个问题并解决了它。我曾尝试研究过这个问题,但没有找到答案。
因此我在安装并尝试运行后收到此警告docker run hello-world
。
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.
我一直在尝试在 Windows 中的 Ubuntu 16.04 上正确安装 docker-ce,因为我只有 Windows 10 家庭版。不打算将我的 Windows 10 升级到任何其他版本。我尝试了几种方法。我查看了几个来源并按照说明操作,但仍然遇到该问题。
https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce-1
我运行sudo systemctl status docker
并收到此错误:
The command could not be located because '/usr/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
service: command not found
我通过设置 PATH 解决了这个问题
PATH="/sbin:$PATH"
摘自本文: https://askubuntu.com/questions/972611/why-does-sbin-not-included-in-path-for-new-user
在此之后,我最终运行了sudo service docker status
,结果显示 Docker 没有运行,所以我运行了sudo service docker start
我再次检查了状态,它显示正在运行。我运行docker info
后得到以下结果:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.09.6
Storage Driver: overlay2
Backing Filesystem: <unknown>
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Kernel Version: 4.4.0-17134-Microsoft
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.89GiB
Name: DESKTOP-MA8QOES
ID: AD4R:WH7W:VHRE:ZSMY:GIE7:7ZTC:G4FK:L6AV:OTMY:QLC3:B7H3:LRC2
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No cpu shares support
WARNING: No cpuset support
我sudo docker run hello-world
再次测试收到此消息:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Extracting [==================================================>] 977B/977B
docker: failed to register layer: Error processing tar file(exit status 1): invalid argument.
See 'docker run --help'.
现在不确定该做什么...任何帮助都将不胜感激。