Tecnativa / Tecnativa/docker-socket-proxy

Difference in Docker Socket Behavior When Forwarding via TCP vs HTTP with HAProxy

Open
#159 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.8k
Forks
207
PR merge metrics
No merged PRs in 30d

Description

I am looking for a service that forwards a Docker socket to TCP. So far, I have found this project and the socat project.

Here are the commands I am using:

docker run -d \
  --name docker-socket-proxy \
  -p 2377:2375 \
  -e AUTH=1 \
  -e SECRETS=1 \
  -e POST=1 \
  -e BUILD=1 \
  -e COMMIT=1 \
  -e CONFIGS=1 \
  -e CONTAINERS=1 \
  -e ALLOW_START=1 \
  -e ALLOW_STOP=1 \
  -e ALLOW_RESTARTS=1 \
  -e DISTRIBUTION=1 \
  -e EXEC=1 \
  -e GRPC=1 \
  -e IMAGES=1 \
  -e INFO=1 \
  -e NETWORKS=1 \
  -e NODES=1 \
  -e PLUGINS=1 \
  -e SERVICES=1 \
  -e SESSION=1 \
  -e SWARM=1 \
  -e SYSTEM=1 \
  -e TASKS=1 \
  -e VOLUMES=1 \
  -e DISABLE_IPV6=1 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  ghcr.io/tecnativa/docker-socket-proxy:latest

docker run -d --name=dockersock2tcp -p 2375:2375 -v /var/run/docker.sock:/var/run/docker.sock alpine/socat TCP-LISTEN:2375,reuseaddr,keepalive,fork UNIX-CONNECT:/var/run/docker.sock

I noticed that using the same command can produce different results:

env DOCKER_HOST=tcp://localhost:2375 docker buildx ls

After investigating, I found that the difference is due to haproxy.cfg using mode http. When I switched it to mode tcp, it worked as expected.

Is this known behavior? Could you please explain why this option causes different Docker behavior?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with haproxy.cfg and compare its mode http and mode tcp settings against the Docker buildx ls commands in the report. Reproduce both forwarding paths, then determine whether the difference is expected and document the cause or the required configuration change.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops, networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.