0.环境配置

配置docker

  1. 安装docker
1
2
sudo apt update
sudo apt install docker.io
  1. 启动docker服务
1
sudo systemctl start docker
  1. 验证安装成功
1
2
3
sudo docker pull docker.m.doacloud.io/hello-world
sudo docker run hello-world
sudo docker images

输出分别如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
┌──(qlc㉿kali)-[~]
└─$ sudo docker pull docker.m.daocloud.io/hello-world
Using default tag: latest
latest: Pulling from hello-world
Digest: sha256:452a468a4bf985040037cb6d5392410206e47db9bf5b7278d281f94d1c2d0931
Status: Image is up to date for docker.m.daocloud.io/hello-world:latest
docker.m.daocloud.io/hello-world:latest
┌──(qlc㉿kali)-[~]
└─$ sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/
┌──(qlc㉿kali)-[~]
└─$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest e2ac70e7319a 6 days ago 10.1kB
docker.m.daocloud.io/hello-world latest e2ac70e7319a 6 days ago 10.1kB
  1. 换源加速
1
2
cd /etc/docker 
sudo vim daemon.json

在.json文件中添加内容

1
2
3
4
5
6
7
8
9
{
"registry-mirrors": [
"https://proxy.1panel.live",
"https://docker.1panel.top",
"https://docker.m.daocloud.io",
"https://docker.1ms.run",
"https://docker.ketches.cn"
]
}
1
2
sudo systemctl daemon-reload
sudo systemctl restart docker

拉取并运行hello-world验证

1
2
sudo docker pull hello-world
sudo docker run docker.m.daocloud.io/hello-world
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
┌──(qlc㉿kali)-[~]
└─$ sudo docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
Digest: sha256:452a468a4bf985040037cb6d5392410206e47db9bf5b7278d281f94d1c2d0931
Status: Image is up to date for hello-world:latest
docker.io/library/hello-world:latest
┌──(qlc㉿kali)-[~]
└─$ sudo docker run docker.m.daocloud.io/hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/