To connect to the remote Engine API, you might need to provide the location of the Engine API for Docker clients and development tools.
Mac and Windows WSL 2 users can connect to the Docker Engine through a Unix socket: unix:///var/run/docker.sock
.
If you are working with applications like Apache Maven that expect settings for DOCKER_HOST
and DOCKER_CERT_PATH
environment variables, specify these to connect to Docker instances through Unix sockets.
For example:
$ export DOCKER_HOST=unix:///var/run/docker.sock
Docker Desktop Windows users can connect to the Docker Engine through a named pipe: npipe:////./pipe/docker_engine
, or TCP socket at this URL: tcp://localhost:2375
.
For details, see Docker Engine API.
socketPath: '//./pipe/docker_engine'
// For Mac OS X:
// socat -d -d unix-l:/tmp/docker.sock,fork tcp:<docker-host>:4243
// DOCKER_SOCKET=/tmp/docker.sock npm test
// For Windows:
// https://github.com/apocas/dockerode/issues/290#issuecomment-276393388
// socketPath: '//./pipe/docker_engine'
var socket = process.env.DOCKER_SOCKET || isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock';