How to verify my docker-compose.yml? - docker

I am setting up a container stack using docker-compose. Yet by running
docker-compose up
I get a rather cryptic error message:
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'
How to debug? I have checked that the yml is valid, yet it doesn't work.

I forgot to save my docker-compose.yml, so it was empty.
I stumbled across the solution in this issue about making the error message better which was describing the behavior.
One gets a nice message if no docker-compose.yml exists at all:
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
It was anounced on the docker-compose's issue list that there will be a nicer error message in the upcomming 1.5 release:
Top level object needs to be a dictionary. Check your .yml file that
you have defined a service at the top level.
As of version 1.7.1 the error message indicating that your file is empty reads:
ERROR: Top level object in './docker-compose.yml' needs to be an
object not '<type 'NoneType'>'.
Given the latest versions, the error message is very straightforward:
$ docker -v
Docker version 19.03.13, build 4484c46d9d
$ docker build .
failed to solve with frontend dockerfile.v0: failed to create LLB definition: the Dockerfile cannot be empty
So for ease of use, consider upgrading your docker engine.

Related

ansible-container docker.errors.DockerException: Error while fetching server API version

I am trying to build a container using ansible-container module on my Mac and running into the following issue.
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible-container build --roles-path=/Users/karthikjayaraman/roles
Building Docker Engine context...
Starting Docker build of Ansible Container Conductor image (please be patient)...
Parsing conductor CLI args.
Dockerâ„¢ daemon integration engine loaded. Build starting. project=infrastructure
Building service... project=infrastructure service=mdcsat
Traceback (most recent call last):
File "/usr/bin/conductor", line 11, in <module>
load_entry_point('ansible-container', 'console_scripts', 'conductor')()
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/cli.py", line 399, in conductor_commandline
**params)
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/core.py", line 700, in conductorcmd_build
cur_image_id = engine.get_image_id_by_tag(service['from'])
File "/_ansible/container/docker/engine.py", line 549, in get_image_id_by_tag
image = self.client.images.get(tag)
File "/_ansible/container/docker/engine.py", line 164, in client
self._client = docker.from_env(version='auto', timeout=timeout)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 80, in from_env
**kwargs_from_env(**kwargs))
File "/usr/lib/python2.7/site-packages/docker/client.py", line 37, in __init__
self.api = APIClient(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 147, in __init__
self._version = self._retrieve_server_version()
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 174, in _retrieve_server_version
'Error while fetching server API version: {0}'.format(e)
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))
Conductor terminated. Cleaning up. command_rc=1 conductor_id=6a4f7bcb46a33b8053d22af2ecc17abaa84abddf99f80f133b921546d36c76fc save_container=False
ERROR Conductor exited with status 1
The build numbers of the components are as follows:
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible --version
ansible 2.6.1
config file = /Users/karthikjayaraman/mdc/mdc/tools/infrastructure/ansible.cfg
configured module search path = [u'/Users/karthikjayaraman/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Python/2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.10 (default, Oct 6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ docker --version
Docker version 18.03.1-ce, build 9ee9f40
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible-container version
Ansible Container, version 0.9.2
Docker on my Mac is installed and running well.
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Any help appreciated !.
Are you sure, you added your user account to the docker group? (your = account you run ansible-container under)
See here: https://docs.docker.com/engine/installation/linux/linux-postinstall/

Pytest fails on Travis: cannot find main package

I recently made a large swath of changes to a Python 3 project on Github, largely documentation and docstrings.
The tests pass locally, but when I push the branch to Github, Travis CI fails:
$ pytest
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/config.py", line 342, in _getconftestmodules
return self._path2confmods[path]
KeyError: local('/home/travis/build/scossu/lakesuperior')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/config.py", line 373, in _importconftest
return self._conftestpath2mod[conftestpath]
KeyError: local('/home/travis/build/scossu/lakesuperior/conftest.py')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/config.py", line 379, in _importconftest
mod = conftestpath.pyimport()
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/py/_path/local.py", line 668, in pyimport
__import__(modname)
File "/home/travis/virtualenv/python3.5.5/lib/python3.5/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
py.builtin.exec_(co, mod.__dict__)
File "/home/travis/build/scossu/lakesuperior/conftest.py", line 6, in <module>
from lakesuperior.config_parser import test_config
ImportError: No module named 'lakesuperior.config_parser'
ERROR: could not load /home/travis/build/scossu/lakesuperior/conftest.py
The command "pytest" exited with 4.
lakesuperior is the main application package.
My .travis.yml:
language: python
python:
- "3.5"
- "3.6"
install:
- pip install -r requirements.txt
- coilmq&
script:
- pytest tests
The only thing that I think may have affected the import issue is that I added some __init__.py files to subpackages in order for Sphinx to discover API docs. I am not sure how that may have messed up CI though.
I verified that the previous commit passes all tests as it used to.
Has anybody encountered this scenario before? Any hints?
Thanks.
I recently had the same issue. I fixed it by removing the __init__.py file from the top level directory. See here.

Telegram iOS app could't not run on Xcode

I have download the source code of Telegram app on their website:https://telegram.org/source.
When I try to run the project, there show an error like below:
UFW (M iphonesimulator): ERROR: Build failed
Traceback (most recent call last):
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 812, in <module>
run_build()
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 787, in run_build
add_symlinks_to_framework(project)
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 675, in add_symlinks_to_framework
attempt_symlink(os.path.join(base_dir, "Versions", "Current"), os.environ['FRAMEWORK_VERSION'])
File "/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Intermediates/MtProtoKit.build/Debug-iphonesimulator/MtProtoKit iOS.build/Script-D05A831218AFB3F9007F1076.sh", line 493, in attempt_symlink
os.stat(os.path.abspath(os.path.join(link_path, "..", link_to)))
OSError: [Errno 2] No such file or directory: '/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Products/Debug-iphonesimulator/MtProtoKit iOS.framework/Versions/A'
Showing first 200 notices only
Command /bin/sh failed with exit code 1
I didn't change anything before I try to run the project.
Telegram uses currently retired project https://github.com/kstenerud/iOS-Universal-Framework
Install 'iOS-Universal-Framework' and with couple of additional fixes you will be able to build it.
OSError: [Errno 2] No such file or directory: '/Users/macbookpro/Library/Developer/Xcode/DerivedData/MtProtoKit-afodmttritvhhdfajtdrsgmygsll/Build/Products/Debug-iphonesimulator/MtProtoKit iOS.framework/Versions/A'
You are referencing to a third party library that isn't there.

Running html5 app template in ubuntu sdk failed?

My configuration :
Ubuntu 14.04 LTS
64bit
Qtcreator 3.1.1
everything is up-to-date
Hello everyone,
I'm trying to just compile and run an HTML5 App for ubuntu Phone, but after trying and searching for a week now, I still can't make it run !
For the moment I just want to run the simple html5 app template.
This is the situation :
I have installed ubuntu sdk as instructed in https://developer.ubuntu.com/en/start/ubuntu-sdk/installing-the-sdk/
I've created in the run click menu, an i386 build target. (15.04) --- which exited with no errors
I created an i386 emulator in devices --> i386 - devel - default password --- which is finally up and running correctly
The problem is when I compile the default template : theses are the errors I get :
desktop_Exec(app): found unexpected Exec with architecture 'all':./qtc_device_debughelper.py
security_policy_groups_safe_app(debug):(REJECT)reserved policy group 'debug':not for production use
security_policy_version_matches_framework(app.apparmor):invalid framework 'ubuntu-core-15.04'
And when I try to edit it anyway :
This is what I get :
Traceback (most recent call last):
File "/tmp/qtc_device_applaunch.py", line 29, in <module>
gi.Repository.get_default().require("UbuntuAppLaunch")
gi.RepositoryError: Typelib file for namespace 'UbuntuAppLaunch' (any version) not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/qtc_device_applaunch.py", line 33, in <module>
from gi.repository import UpstartAppLaunch as UAL
File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name UpstartAppLaunch, introspection typelib not found
I have been looking for this everywhere but I couldn't find something that works.
I need some of your knowledge to help me understand all this!
I have the same errors. I think that the 'ubuntu-core-15.04'-error is related to the version of Ubuntu you are using. I use Mint 17, which is based on Ubuntu 14.04. Canonical recommends the newer Ubuntu Versions for app-developing, because there is some stuff in it they changed.
unfortunately, I can't help you with the other errors.

"No such file or directory" when trying to run a newly created app

I just discovered forge and wanted to try it out at once. I closely followed the tutorial at http://docs.trigger.io/en/v1.3/getting-started.html#mac-and-linux-users and everything went fine, until I tried to actually run my app:
(forge-environment) forge run web
[ INFO] Forge tools running at version 3.3.2
[ INFO] Checking JavaScript files...
[ INFO] JavaScript check complete
[ INFO] Verifying your configuration settings...
[ INFO] Configuration settings check complete
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/mononofu/Programmieren/ArmorCalc/.template/generate_dynamic/utils.py", line 163, in runner
state.proc = lib.PopenWithoutNewConsole(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=kw.get('env'))
File "/home/mononofu/Programmieren/ArmorCalc/.template/generate_dynamic/lib.py", line 155, in __init__
self._old_popen.__init__(self, *args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
(it doesn't actually crash, just hangs for a while, then quits with status 131)
This happens no matter how I try to run it (android, web). I'm on Ubuntu 12.04, everything updated. I didn't change anything from the defaults, just create and then build
Any ideas?
The underlying error was adb not being found to interact with the emulator / device: we've fixed the poor error message here so that other Linux users won't be stuck in the same way!

Resources