Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Replace Docker Daemon Socket

雾雨 edited this page Sep 24, 2020 · 2 revisions

Replace docker daemon default socket by barrel socket

  1. You should edit barrel conf by the Config
  • Section of config
# the following line is the host addresses of barrel, they are previous default value of docker socket
#
BARREL_HOSTS=unix:///var/run/docker.sock,https://10.22.12.88:2376

# the following line is the dockerd unix socket path, changed it to other values
# 
BARREL_DOCKERD_PATH=unix:///var/run/dockerd.sock

# Https port is on, tls certs should also be provided
#
BARREL_TLS_CERT_FILE_PATH=/etc/docker/tls/server.crt
BARREL_TLS_KEY_FILE_PATH=/etc/docker/tls/server.key
  1. You should edit docker daemon config(/etc/docker/daemon.json)
{
    "hosts": ["unix:///var/run/dockerd.sock"],
    "tlsverify": true,
    "tlscacert": "/etc/docker/tls/ca.crt",
    "tlscert": "/etc/docker/tls/server.crt",
    "tlskey": "/etc/docker/tls/server.key",
    "cluster-store": "etcd://127.0.0.1:2379"
}
  1. You should edit value of ListenStream in systemd config of docker.socket
[Unit]
Description=Docker Socket for the API
PartOf=docker.service

[Socket]
ListenStream=/var/run/dockerd.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target