docker实战 开启远程服务
Last updated on November 22, 2024 pm
🧙 Questions
开启docker远程服务,可以让用户通过port访问,并执行命令
☄️ Ideas
修改docker服务配置文件
sudo vim /lib/systemd/system/docker.service
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
# ispong :) 修改为下面一行
ExecStart=/usr/bin/dockerd --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
修改docker配置文件
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://3fe1zqfu.mirror.aliyuncs.com"],
"data-root":"/data/docker",
"hosts": [
"fd://",
"tcp://0.0.0.0:30013"
]
}
sudo systemctl daemon-reload
sudo systemctl restart docker
🔗 Links
docker实战 开启远程服务
https://ispong.isxcode.com/kubernetes/docker/docker 远程服务/