docker / docker-py

A Python library for the Docker Engine API

Home Page:https://docker-py.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contexts not found when there is no config.json

AstraLuma opened this issue · comments

docker.context.config.get_meta_dir() indirectly depends on docker.utils.config.find_config_file(), which fails if ~/.docker exists but ~/.docker/config.json doesn't.

For example:

$ find ~/.docker
/home/astraluma/.docker
/home/astraluma/.docker/buildx
# ... skipping all the buildx stuff ...
/home/astraluma/.docker/.token_seed.lock
/home/astraluma/.docker/.token_seed
/home/astraluma/.docker/contexts
/home/astraluma/.docker/contexts/meta
/home/astraluma/.docker/contexts/meta/9bfaad6047affcb5aea9994b8886dc52eec0e2f0803f79fb9f2ac4277d037666
/home/astraluma/.docker/contexts/meta/9bfaad6047affcb5aea9994b8886dc52eec0e2f0803f79fb9f2ac4277d037666/meta.json

This causes the docker python client to fail to find any contexts.

Simply running touch ~/.docker/config.json works around this.