Docker for Python get DOCKER_HOST

528 Views Asked by At

I'm trying to find the DOCKER_HOST for my docker registry.

Looking at the sdk, I know it's possible to set the DOCKER_HOST.

enter image description here

But is it possible to find the current DOCKER_HOST been used?

import docker
client = docker.from_env()
client.info()
1

There are 1 best solutions below

0
On

DOCKER_HOST is an optional value.

The default Docker host (and local registry) is a socket on localhost. I wouldn't expect that you'll find a DOCKER_HOST set unless you have chosen to set one.

Various things can override, however, so it really depends on your local environment and setup.

  • DOCKER_HOST value
  • DOCKER_CONTEXT value
  • A context set using the docker context command
  • A context set using the -c flag to the docker command

Reference (docs.docker.com)