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

Dockerfile doesn't work #748

Closed
ozbillwang opened this issue Jul 25, 2020 · 4 comments
Closed

Dockerfile doesn't work #748

ozbillwang opened this issue Jul 25, 2020 · 4 comments

Comments

@ozbillwang
Copy link

$ docker build -t cloudmapper . 

$ docker run -ti --rm cloudmapper bash 
root@7f0ad00a93e6:/opt/cloudmapper# python cloudmapper.py prepare --config config.json.demo --account demo
Building data for account demo (123456789012)
Traceback (most recent call last):
  File "cloudmapper.py", line 72, in <module>
    main()
  File "cloudmapper.py", line 66, in main
    commands[command].run(arguments)
  File "/opt/cloudmapper/commands/prepare.py", line 831, in run
    prepare(account, config, outputfilter)
  File "/opt/cloudmapper/commands/prepare.py", line 660, in prepare
    cytoscape_json = build_data_structure(account, config, outputfilter)
  File "/opt/cloudmapper/commands/prepare.py", line 419, in build_data_structure
    for region_json in get_regions(account, outputfilter):
  File "/opt/cloudmapper/shared/common.py", line 161, in get_regions
    regions = pyjq.all(".Regions[]{}".format(region_filter), region_data)
  File "/usr/local/lib/python3.7/site-packages/pyjq.py", line 49, in all
    return compile(script, vars, library_paths).all(_get_value(value, url, opener))
  File "_pyjq.pyx", line 209, in _pyjq.Script.all (_pyjq.c:2561)
_pyjq.ScriptRuntimeError: Cannot iterate over null (null)
root@7f0ad00a93e6:/opt/cloudmapper#
ozbillwang pushed a commit to ozbillwang/cloudmapper that referenced this issue Jul 25, 2020
ozbillwang added a commit to ozbillwang/cloudmapper that referenced this issue Jul 25, 2020
@0xdabbad00
Copy link
Collaborator

This issue does not appear to be related to Docker.

@ozbillwang
Copy link
Author

ozbillwang commented Jul 26, 2020

@0xdabbad00

It does.

Use the same image I build with exist Dockerfile, but I mount the repo to container (-v $(pwd):/opt/cloudmapper ), it works.

Could you try it on your computer? this problem is easily duplicated

$ git clone git@github.com:duo-labs/cloudmapper.git
$ cd cloudmapper
$ docker build -t cloudmapper .

# doesn't work, that's the issue I reported here.
$ docker run -ti --rm cloudmapper bash 
root@3095bc277b04:/opt/cloudmapper# python cloudmapper.py prepare --config config.json.demo --account demo
....
....
_pyjq.ScriptRuntimeError: Cannot iterate over null (null)

# does work
$ docker run -ti --rm -v $(pwd):/opt/cloudmapper cloudmapper bash
root@fab09cf1fd9b:/opt/cloudmapper# python cloudmapper.py prepare --config config.json.demo --account demo
Building data for account demo (123456789012)
- 16 nodes built in region us-east-1
- 3 external CIDRs built
- 35 connections built
root@fab09cf1fd9b:/opt/cloudmapper#

@mingfang
Copy link

This issue does not appear to be related to Docker.

@0xdabbad00 I'm seeing exactly this same problem.
What do you think is the problem?

@mingfang
Copy link

This issue does not appear to be related to Docker.

@0xdabbad00 I'm seeing exactly this same problem.
What do you think is the problem?

I figured out the problem; I was missing the account-data/demo because .dockerignore prevented the account-data from getting added to the docker image(a good thing).
To run the demo using docker, you must bind mount the account-data directory, e.g.

docker run --rm -it -p 8000:8000 -v `pwd`/account-data:/opt/cloudmapper/account-data  cloudmapper /bin/bash

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

No branches or pull requests

3 participants