Linux下絲滑使用docker

MarmaladeCat發表於2024-10-19

安裝docker

安裝由debian維護的docker.io,參考https://www.kali.org/docs/containers/installing-docker-on-kali/

sudo apt update
sudo apt install docker.io
sudo systemctl enable docker --now

為普通使用者新增docker的許可權

sudo usermod -aG docker $USER

更改docker映象(參考了https://www.cnblogs.com/yuzhihui/p/17461781.html)

sudo vim /etc/docker/daemon.json 

新增內容如下

{
  "registry-mirrors": [
	  "https://dockerproxy.cn"		
  ]
}

然後重啟docker容器

sudo systemctl restart docker

安裝docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

測試

docker run hello-world

相關文章