云服务器安装Docker

来自极益平台知识库
跳转至: 导航搜索

一条命令装Docker

daocloud命令,一条解决,快

curl -sSL https://get.daocloud.io/docker | sh

官方命令,一条命令解决 ,慢

curl -sSL https://get.docker.com/ | sh

安装docker-compose,最好装了

sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose


即可。

这一步完成之后,就可以去Docker方式一条命令装NGOOS 安装NGOOS了。

测试安装完成

docker run hello-world

如果显示如下,就安装完成:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete 
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.

手贱方式安装,复杂,可忽略

root用户下,如果遇到-bash: sudo: command not found,去掉前面的sudo,执行的时候,可能让你看一些文件,按“q”,退出

sudo apt-get update
sudo apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce

参考:http://guide.daocloud.io/dcs/docker-9152677.html https://docs.docker.com/engine/installation/linux/docker-ce/debian/