Debian-kali 安装docker

docker官方安装文档:https://docs.docker.com/engine/install/debian/

通过仓库安装

Install using the repository

 

 

1.Update the apt package index and install packages to allow apt to use a repository over HTTPS:

$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

 

2.Add Docker’s official GPG key:添加docker源证书

  $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

3.Add respository-tsinghua

echo 'deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/ buster stable' | sudo tee /etc/apt/sources.list.d/docker.list

4.Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

  $ sudo apt-get update

  $ sudo apt-get install docker-ce docker-ce-cli containerd.io

 

#2.Set up docker without sudo

To create the docker group and add your user:

  1. Create the docker group.

    $ sudo groupadd docker
    
  2. Add your user to the docker group.

    $ sudo usermod -aG docker $USER
    
  3. Log out and log back in so that your group membership is re-evaluated.

    If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.

    On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.

    On Linux, you can also run the following command to activate the changes to groups:

    $ newgrp docker 
    
  4. Verify that you can run docker commands without sudo.

    $ docker run hello-world
    

    This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.

 

 

 

 

 

 

posted @ 2021-10-21 16:05  Control_man  阅读(80)  评论(0)    收藏  举报