### What happened?

When we attempt at following the documentation of [Dynamic Grid](https://github.com/SeleniumHQ/docker-selenium#dynamic-grid) the docker node does not come up and crashes.



### How can we reproduce the issue?

Ensure that you dont have any of the selenium related docker container images in your machine by running 

1. `docker container prune` to prune the images being used by stopped containers
2. `docker rmi $(docker images | grep selenium | awk '{print $3}')` clean up all selenium images

Create a docker-compose file named `docker-compose-v3-dynamic-grid.yml` that looks like below:

```yaml
# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-dynamic-grid.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-dynamic-grid.yml down`
version: "3"
services:
  node-docker:
    image: selenium/node-docker:4.6.0-20221104
    volumes:
      - ./config.toml:/opt/bin/config.toml
    depends_on:
      - selenium-hub-dynamic
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub-dynamic
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "5005:5005"
     
  selenium-hub-dynamic:
    image: selenium/hub:4.6.0-20221104
    container_name: selenium-hub-dynamic
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4455:4444"
```

In the same directory create a toml configuration file named `config.toml` with its contents as below:

```toml
[docker]
# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to
# start a container with the given image.
configs = [
    "selenium/standalone-firefox:4.6.0-20221104", "{\"browserName\": \"firefox\"}",
    "selenium/standalone-chrome:4.6.0-20221104", "{\"browserName\": \"chrome\"}",
    "selenium/standalone-edge:4.6.0-20221104", "{\"browserName\": \"MicrosoftEdge\"}"
    ]
    
# URL for connecting to the docker daemon
# Most simple approach, leave it as http://127.0.0.1:2375, and mount /var/run/docker.sock.
# 127.0.0.1 is used because interally the container uses socat when /var/run/docker.sock is mounted 
# If var/run/docker.sock is not mounted: 
# Windows: make sure Docker Desktop exposes the daemon via tcp, and use http://host.docker.internal:2375.
# macOS: install socat and run the following command, socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock,
# then use http://host.docker.internal:2375.
# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.
# I am on mac
url =  "http://host.docker.internal:2375"

# Docker image used for video recording
#video-image = "selenium/video:ffmpeg-4.3.1-20220531"

# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
#[server]
#host = "10.136.130.15"#<ip-from-node-machine>
#port = "5555"#<port-from-node-machine>
```

Setup socat forwarding (I am on Mac and so I installed `socat` and run the following command, `socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock`

Now bring up the nodes by running `docker-compose -f docker-compose-v3-dynamic-grid.yml up`
```


### Relevant log output

```shell
sunny-node-docker-1   | 10:31:07.650 INFO [PullImage.apply] - Pulling Reference{domain='docker.io', name='selenium/standalone-firefox', tag='4.6.0-20221104', digest='null'}
sunny-node-docker-1   | java.lang.reflect.InvocationTargetException
sunny-node-docker-1   |         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sunny-node-docker-1   |         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sunny-node-docker-1   |         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
sunny-node-docker-1   |         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
sunny-node-docker-1   |         at org.openqa.selenium.grid.Bootstrap.runMain(Bootstrap.java:77)
sunny-node-docker-1   |         at org.openqa.selenium.grid.Bootstrap.main(Bootstrap.java:70)
sunny-node-docker-1   | Caused by: org.openqa.selenium.grid.config.ConfigException: java.lang.reflect.InvocationTargetException
sunny-node-docker-1   |         at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:115)
sunny-node-docker-1   |         at org.openqa.selenium.grid.node.config.NodeOptions.getNode(NodeOptions.java:152)
sunny-node-docker-1   |         at org.openqa.selenium.grid.node.httpd.NodeServer.createHandlers(NodeServer.java:128)
sunny-node-docker-1   |         at org.openqa.selenium.grid.node.httpd.NodeServer.asServer(NodeServer.java:184)
sunny-node-docker-1   |         at org.openqa.selenium.grid.node.httpd.NodeServer.execute(NodeServer.java:239)
sunny-node-docker-1   |         at org.openqa.selenium.grid.TemplateGridCommand.lambda$configure$4(TemplateGridCommand.java:129)
sunny-node-docker-1   |         at org.openqa.selenium.grid.Main.launch(Main.java:83)
sunny-node-docker-1   |         at org.openqa.selenium.grid.Main.go(Main.java:57)
sunny-node-docker-1   |         at org.openqa.selenium.grid.Main.main(Main.java:42)
sunny-node-docker-1   |         ... 6 more
sunny-node-docker-1   | Caused by: java.lang.reflect.InvocationTargetException
sunny-node-docker-1   |         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sunny-node-docker-1   |         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sunny-node-docker-1   |         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
sunny-node-docker-1   |         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
sunny-node-docker-1   |         at org.openqa.selenium.grid.config.ClassCreation.callCreateMethod(ClassCreation.java:50)
sunny-node-docker-1   |         at org.openqa.selenium.grid.config.MemoizedConfig.lambda$getClass$4(MemoizedConfig.java:100)
sunny-node-docker-1   |         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1737)
sunny-node-docker-1   |         at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:95)
sunny-node-docker-1   |         ... 14 more
sunny-node-docker-1   | Caused by: java.lang.IllegalArgumentException: non-positive contentLength: 0
sunny-node-docker-1   |         at java.net.http/java.net.http.HttpRequest$BodyPublishers.fromPublisher(HttpRequest.java:539)
sunny-node-docker-1   |         at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.notChunkingBodyPublisher(JdkHttpMessages.java:124)
sunny-node-docker-1   |         at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.createRequest(JdkHttpMessages.java:76)
sunny-node-docker-1   |         at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:280)
sunny-node-docker-1   |         at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)
sunny-node-docker-1   |         at org.openqa.selenium.docker.v1_41.PullImage.apply(PullImage.java:63)
sunny-node-docker-1   |         at org.openqa.selenium.docker.v1_41.V141Docker.getImage(V141Docker.java:80)
sunny-node-docker-1   |         at org.openqa.selenium.docker.Docker.lambda$getImage$0(Docker.java:51)
sunny-node-docker-1   |         at java.base/java.util.Optional.map(Optional.java:265)
sunny-node-docker-1   |         at org.openqa.selenium.docker.Docker.getImage(Docker.java:51)
sunny-node-docker-1   |         at org.openqa.selenium.grid.node.docker.DockerOptions.lambda$loadImages$4(DockerOptions.java:260)
sunny-node-docker-1   |         at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
sunny-node-docker-1   |         at java.base/java.lang.Thread.run(Thread.java:829)
sunny-node-docker-1   | Exception in thread "Thread-0" java.lang.NullPointerException
sunny-node-docker-1   |         at org.openqa.selenium.grid.node.httpd.NodeServer.lambda$new$0(NodeServer.java:80)
sunny-node-docker-1   |         at java.base/java.lang.Thread.run(Thread.java:829)
sunny-node-docker-1   | 2022-12-01 10:31:08,079 INFO exited: selenium-grid-docker (exit status 1; not expected)
```


### Operating System

macOS

### Selenium version

Java 4.6.0

### What are the browser(s) and version(s) where you see this issue?

Not relevant

### What are the browser driver(s) and version(s) where you see this issue?

Not relevant

### Are you using Selenium Grid?

4.6.0
private static final Json JSON = new Json();
  private static final Type SET_OF_IMAGE_SUMMARIES = new TypeToken<Set<ImageSummary>>() {}.getType();
  private final HttpHandler client;
  public ListImages(HttpHandler client) {
    this.client = Require.nonNull("HTTP client", client);
  }
  public Set<Image> apply(Reference reference) {
    Require.nonNull("Reference to search for", reference);
    String familiarName = reference.getFamiliarName();
    Map<String, Object> filters = ImmutableMap.of("reference", ImmutableMap.of(familiarName, true));
    
    HttpRequest req = new HttpRequest(GET, String.format("/v%s/images/json", DOCKER_API_VERSION))
      .addHeader("Content-Length", "0")
      .addHeader("Content-Type", JSON_UTF_8)
      .addQueryParameter("filters", JSON.toJson(filters));
    HttpResponse response = DockerMessages.throwIfNecessary(
      client.execute(req),
      "Unable to list images for %s", reference);
    Set<ImageSummary> images =
      JSON.toType(string(response), SET_OF_IMAGE_SUMMARIES);
    return images.stream()
      .map(org.openqa.selenium.docker.Image::new)
      .collect(toImmutableSet());
  }
}