0

I am trying to set up Docker on an EC2 server, and I am trying to start it up with the -H flag for the Hosts.

What I have:

/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --default-ulimit nofile=32768:65536

What I want:

/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 --containerd=/run/containerd/containerd.sock --default-ulimit nofile=32768:65536

When I ran the dockerd command above, I got:

failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd

So, I have put the configuration under: /etc/docker/daemon.json according to this link:

I added:

{
    "hosts": ["fd://", "tcp://0.0.0.0:2376"]
}

Then, when I run: systemctl start docker, the daemon doesn't come up.

It seems unnecessarily complicated, but can someone please help me out here? I am a little rusty. Thanks

Sean
  • 1,151
  • 3
  • 15
  • 37
  • 1
    Look at the `ExecStart` in the service definition. You can create an overlay to extend it. – Charles Duffy Sep 01 '22 at 14:56
  • 1
    Do you have a `docker.socket` defined? Did you appropriately edit `docker.service`? If you haven't edited the systemd configuration to turn on socket activation, then... well, it's not turned on. Just adding the command-line argument isn't enough. A broader "how do I configure socket activation?" from a sysadmin perspective (which seems to be how this is posed) rather than a software-developer perspective is probably better suited to [unix.se]. – Charles Duffy Sep 01 '22 at 14:57
  • 1
    In general, if you're using `docker.service` provided by your OS vendor, it's probably better to follow their lead -- use socket activation if-and-only-if they support it, and don't use it when they don't, so you don't need to worry about whether the next package update will break your configuration. You certainly _can_ provide overlays that are used to update the vendor setup, but if you're going to be deploying to production there's still testing called for on updates to make sure new configs and your overlays continue to play well together. – Charles Duffy Sep 01 '22 at 15:01
  • Thanks @CharlesDuffy! Your first comment gave me what I was looking for - to start with. I had to do a lot of reading over the weekend to understand this. Please provide it as an answer and I will accept it – Sean Sep 05 '22 at 01:53

0 Answers0