sudo apt-get install --reinstall systemd
$ sudo systemctl enable docker
-
Update theaptpackage index:
$ sudo apt-get update
-
Install packages to allowaptto use a repository over HTTPS:
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
-
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid [ unknown] Docker Release (CE deb) <docker@docker.com> sub rsa4096 2017-02-22 [S]
- Use the following command to set up the stable repository. To add the nightly or test repository, add the wordnightlyortest(or both) after the wordstablein the commands below. Learn about nightly and testchannels.
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-
Install Docker Engine - Community
- Update theaptpackage index.
$ sudo apt-get update
$ sudo apt-get install docker-ce
- Update theaptpackage index.
-
- Create thedockergroup.
$ sudo groupadd docker
- Create thedockergroup.
- Add your user to thedockergroup.
$ sudo usermod -aG docker lava
-
Log out and log back in so that your group membership is re-evaluated.
$ newgrp docker
- Verify that you can rundockercommands withoutsudo.
$ docker run hello-world
- 添加开机启动docker配置
sudo apt-get install --reinstall systemd
$ sudo systemctl enable docker