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:
-
Create the
dockergroup.$ sudo groupadd docker -
Add your user to the
dockergroup.$ sudo usermod -aG docker $USER -
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 -
Verify that you can run
dockercommands withoutsudo.$ docker run hello-worldThis command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.
浙公网安备 33010602011771号