agentscope-runtime-java
agentscope-runtime-java copied to clipboard
[Bug] DockerClient createContainer defaults IP to localhost, causing startup failure when connecting to remote daemon
When using DockerClient to connect to a remote Docker daemon, the createContainer operation appears to default the container's network IP or binding address to localhost (127.0.0.1). Consequently, when startContainer is invoked, it fails because localhost on the client machine does not resolve to the correct network interface of the remote Docker host.
This behavior makes it impossible to start containers on remote daemons without manual network configuration overrides.
Steps to Reproduce
- Configure DockerClient to point to a remote Docker daemon (e.g., via TCP socket tcp://remote-host:2375).
- Call createContainer with default network settings.
- Observe that the created container's configuration reflects localhost for certain network bindings/IPs.
- Call startContainer.
- Result: The operation fails with a connection or binding error, as the client attempts to interact with localhost instead of the remote host's IP.
I can look into this. My idea:
- Check where the container IP/binding is set in the DockerClient code
- Add a configurable host parameter instead of hardcoding localhost
- Default to localhost for backward compatibility, but allow override via config
Mind if I take this?