我尝试这样做:
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'
安装docker
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install docker-engine
sudo service docker start
sudo usermod -aG docker $USER
但这不起作用,当我尝试运行时docker ps
出现错误
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
答案1
我像这样安装 Docker:
1)检查Linux版本:uname -a
-> 你的内核版本需要高于3.8
2) 更新系统:sudo apt-get update
3)添加GPG密钥:
sudo apt-key adv \ --keyserver hkp://ha.pool.sks-keyservers.net:80 \ --recv-keys 58118E89F3A912897C070ADBF76221572C5609D
4)检查服务器连接:
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
5)下载Linux镜像:
sudo apt install linux-image-generic linux-image-extra-virtual
6) 重新启动系统:sudo reboot
7)下载docker:
sudo apt install docker-engine
8)最后为了测试,下载一些图像:
sudo docker run hello-world
对我来说效果很好,这条消息是因为在安装过程中你错过了安装一些重要的东西