通过deb包安装docker --Install from a package

Install from a package

If you cannot use Docker’s repository to install Docker CE, you can download the .deb file for your release and install it manually. You need to download a new file each time you want to upgrade Docker.

  1. Go to https://download.docker.com/linux/ubuntu/dists/, choose your Ubuntu version, browse to pool/stable/, choose amd64, armhf, arm64, ppc64el, or s390x, and download the .deb file for the Docker CE version you want to install.

    Note: To install a nightly package, change the word stable in the URL to nightly. Learn about nightly and test channels.

  2. Install Docker CE, changing the path below to the path where you downloaded the Docker package.

    $ sudo dpkg -i /path/to/package.deb
    
    

    The Docker daemon starts automatically.

  3. Verify that Docker CE is installed correctly by running the hello-world image.

    $ sudo docker run hello-world
    

以上是docker官网给的提示

具体操作步骤:

1.打开链接https://download.docker.com/linux/找到对应系统版本的deb包

以ubuntu18.04 amd64为例,依次选择/bionic/pool/stable/amd64/目录下的:

containerd.io_1.2.5-1_amd64.deb
docker-ce-cli_18.09.63-0ubuntu-bionic_amd64.deb
docker-ce_18.09.63-0ubuntu-bionic_amd64.deb

下载并传到服务器上
2.依次安装:
$ dpkg -i  containerd.io_1.2.5-1_amd64.deb
$ dpkg -i  docker-ce_18.09.6~3-0~ubuntu-bionic_amd64.deb
$ dpkg -i  docker-ce-cli_18.09.6~3-0~ubuntu-bionic_amd64.deb
3.查看是否安装成功:
$ docker --version

Docker version 18.03.0-ce, build 0520e24

4.建立docker组:
$ sudo groupadd docker
5.将当前用户加入docker组:
$ sudo usermod -aG docker $USER
6.重启docker服务
sudo service docker restart
7.切换当前会话到新 group 或者重启 X 会话
newgrp - docker

你可能感兴趣的:(通过deb包安装docker --Install from a package)