1

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()
2
  • I suppose the current one would be in os.environ['DOCKER_HOST']. Commented May 17, 2022 at 23:14
  • I did try this: docker_host = os.environ['DOCKER_HOST'] and I got KeyError: DOCKER_HOST Commented May 17, 2022 at 23:26

1 Answer 1

1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.