Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When docker-compose.yml is emtpy, fail with a human readable error message #2139

Closed
k0pernikus opened this issue Oct 5, 2015 · 4 comments
Closed

Comments

@k0pernikus
Copy link

When there is no docker-compose.yml then there is this nice error message:

$ docker-compose up

        Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml, fig.yml, fig.yaml

Yet if one exists but is empty it produces this output:

$ docker-compose up
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.4.2', 'console_scripts', 'docker-compose')()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 39, in main
    command.sys_dispatch()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
    self.dispatch(sys.argv[1:], None)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 27, in dispatch
    super(Command, self).dispatch(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/docopt_command.py", line 24, in dispatch
    self.perform_command(*self.parse(argv, global_options))
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 57, in perform_command
    verbose=options.get('--verbose'))
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/command.py", line 78, in get_project
    config.load(config_details),
  File "/usr/local/lib/python2.7/dist-packages/compose/config.py", line 138, in load
    for service_name, service_dict in list(dictionary.items()):
AttributeError: 'NoneType' object has no attribute 'items'

This is very hard to debug and was already mentioned in #129 yet this still persists in docker-compose 1.4.2.

@mnowster
Copy link

mnowster commented Oct 5, 2015

Top level object needs to be a dictionary. Check your .yml file that you have defined a service at the top level.

is the error message you will get in forthcoming release 1.5.0

@mnowster mnowster closed this as completed Oct 5, 2015
@ivancarrancho
Copy link

On Ubunto 14 just "sudo", "sudo docker-compose build" fix it XD works for me

@dwaynewei
Copy link

try this one if u haven't solve this problem.
CD to your docker directory:
cd docker/
then, run that order above, which is :
docker-compose up
this may not solve ur problem, but keep trying, u can do it.

@Snipeitsachin
Copy link

on ubuntu machine you con run thise command " sudo docker-compose up -d "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants