enable the remote API for dockerd

本文介绍如何不编辑systemd单元文件即可为dockerd启用远程API。通过创建包含特定设置的文件并重启docker守护进程来实现。注意确保对TCP监听套接字有访问权限的都是受信任的用户。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

After completing these steps, you will have enabled the remote API for dockerd, without editing the systemd unit file in place:

  1. Create a file at /etc/systemd/system/docker.service.d/startup_options.conf with the below contents:

    # /etc/systemd/system/docker.service.d/override.conf
    [Service]
    ExecStart=
    ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376

    Note: The -H flag binds dockerd to a listening socket, either a Unix socket or a TCP port. You can specify multiple -H flags to bind to multiple sockets/ports. The default -H fd:// uses systemd's socket activation feature to refer to /lib/systemd/system/docker.socket.

  2. Reload the unit files:

    $ sudo systemctl daemon-reload

     

  3. Restart the docker daemon with new startup options:

    $ sudo systemctl restart docker.service

     

  4. Ensure that anyone that has access to the TCP listening socket is a trusted user since access to the docker daemon is root-equivalent.

https://success.docker.com/article/how-do-i-enable-the-remote-api-for-dockerd

https://docs.docker.com/engine/security/

转载于:https://www.cnblogs.com/jplus/p/10621536.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值