docker / docker/docker-py

Error initiating docker client. Python hang after trying to find config file

Open
#2,311 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

python hangs on this messages:

2019-04-12 14:13:52,323 [MainThread  ] [DEBUG]  Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
2019-04-12 14:13:52,323 [MainThread  ] [DEBUG]  No config file found
2019-04-12 14:13:52,323 [MainThread  ] [DEBUG]  Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
2019-04-12 14:13:52,323 [MainThread  ] [DEBUG]  No config file found

this is the code:

client = docker.from_env()
    volumes={
    work_dir+'input/album': {'bind': '/code/images', 'mode': 'rw'},
    work_dir+'output/odm_orthophoto': {'bind': '/code/odm_orthophoto', 'mode': 'rw'},
    work_dir+'output/odm_meshing': {'bind': '/code/odm_meshing', 'mode': 'rw'},
    work_dir+'output/odm_georeferencing': {'bind': '/code/odm_georeferencing', 'mode': 'rw'},
    work_dir+'output/odm_texturing': {'bind': '/code/odm_texturing', 'mode': 'rw'},
    work_dir+'output/opensfm': {'bind': '/code/opensfm', 'mode': 'rw'},
    work_dir+'output/pmvs': {'bind': '/code/pmvs', 'mode': 'rw'},
    work_dir+'output/odm_dem': {'bind': '/code/odm_dem', 'mode': 'rw'}
    }

    try:
        container = client.containers.run('opendronemap/opendronemap', command="--skip-3dmodel --time --dtm --dsm", volumes=volumes, auto_remove=True, tty=True, stdin_open=True, detach=False)
        
    except docker.errors.ContainerError:
        logging.error('ERROR: Erro na execução do container docker')
        error = {
            'code': 6,
            'message': 'Erro na execução do container docker'
        }
        
  
        runCommand("sh /home/vantum/vantum-scripts/shutdown.sh")

        sys.exit()
    except docker.errors.ImageNotFound:
        logging.error('ERROR: Imagem docker não encontrada')
        error = {
            'code': 7,
            'message': 'Imagem docker não encontrada'
        }
        
       
      
        runCommand("sh /home/vantum/vantum-scripts/shutdown.sh")

        sys.exit()
    except docker.errors.APIError:
        logging.error('ERROR: Erro na API docker')
        error = {
            'code': 8,
            'message': 'Erro na API docker'
        }
        
       
        runCommand("sh /home/vantum/vantum-scripts/shutdown.sh")

        sys.exit()
    except:
        error = {
            'code': 8,
            'message': 'Erro inesperado no docker: '+sys.exc_info()[0]
        }
        logging.error('ERROR: Erro inesperado no docker: '+error)
        
        logging.info('Saving memory logs')

       
        runCommand("sh /home/vantum/vantum-scripts/shutdown.sh")

        sys.exit()
        raise

Sometimes it gives me except on error code 8, but no error given.

by the way is there a way to store logs on a file?

Contributor guide

Open the contributing guide

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 the shown docker.from_env() call and the DEBUG output for the missing Docker configuration files. Reproduce the hang using the provided client initialization and container call, then trace where execution stops; done means identifying the cause and verifying that the resulting error or logging behavior is observable.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.