Skip to content

Rails Quickstart Fails #73

Closed
Closed

Description

@brandonzylstra

Following the directions for the Rails quick start, I get an error running fig:

$ fig run web rails new . --force --database=postgresql --skip-bundle
Traceback (most recent call last):
  File "/usr/local/bin/fig", line 9, in <module>
    load_entry_point('fig==0.2.0', 'console_scripts', 'fig')()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/main.py", line 39, in main
    command.sys_dispatch()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch
    self.dispatch(sys.argv[1:], None)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/command.py", line 24, in dispatch
    super(Command, self).dispatch(*args, **kwargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch
    self.perform_command(*self.parse(argv, global_options))
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/docopt_command.py", line 27, in perform_command
    handler(command_options)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/cli/main.py", line 215, in run
    container = service.create_container(one_off=True, **container_options)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 108, in create_container
    container_options = self._get_container_options(override_options, one_off=one_off)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 225, in _get_container_options
    container_options['name'] = self.next_container_name(one_off)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 199, in next_container_name
    return '_'.join(bits + [str(self.next_container_number(one_off=one_off))])
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 202, in next_container_number
    numbers = [parse_name(c.name)[2] for c in self.containers(stopped=True, one_off=one_off)]
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/service.py", line 38, in containers
    for container in self.client.containers(all=stopped):
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/packages/docker/client.py", line 399, in containers
    res = self._result(self._get(u, params=params), True)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/fig/packages/docker/client.py", line 98, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 395, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 349, in request
    prep = self.prepare_request(req)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 287, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 287, in prepare
    self.prepare_url(url, params)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 338, in prepare_url
    "Perhaps you meant http://{0}?".format(url))
requests.exceptions.MissingSchema: Invalid URL u'localhost/v1.6/containers/json': No schema supplied. Perhaps you meant http://localhost/v1.6/containers/json?

It is not at all obvious to me what is causing this or where it is coming from. But I checked all files (and even copied the contents from the directions to make sure I had not fat-fingered anything), and the error persisted. All dependencies appeared to install correctly.

Activity

  1. bfirsh commented on Feb 1, 2014

    @bfirsh

    Looks like your Docker URL might not be in a format Fig is expecting. Are you using docker-osx? Could you run echo $DOCKER_HOST and paste the output?

  2. zathomas commented on Feb 1, 2014

    @zathomas

    I saw this just now, and it was because I ran docker-osx shell and fig run in two different terminals.

  3. bfirsh commented on Feb 2, 2014

    @bfirsh

    This should be clearer, but it's that this error showed when you didn't run docker-osx shell. It should be this:

    Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?
    
    If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
    

    Also see #62

  4. bfirsh commented on Mar 3, 2014

    @bfirsh

    Fixed by #77, ref #126

  5. rusllonrails commented on Aug 7, 2014

    @rusllonrails

    Hi Guys,

    Following the directions for the Rails quick start, I get an error running fig:

    $ fig run web rails new . --force --database=postgresql --skip-bundle
    Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?
    If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
    

    I have:
    Ubuntu 14.04

    $ sudo docker version
    Client version: 1.1.2
    Client API version: 1.13
    Go version (client): go1.2.1
    Git commit (client): d84a070
    Server version: 1.1.2
    Server API version: 1.13
    Go version (server): go1.2.1
    Git commit (server): d84a070
    
    $ fig --version
    fig 0.5.2
    

    I found that by default $DOCKER_HOST is missing:

      $ echo $DOCKER_HOST
      # nothing
    

    I tried to set some variants and then reload shell:

    DOCKER_HOST=tcp://localhost:4243
       => Couldn't connect to Docker daemon at http://localhost:4243 - is it running?
    
    DOCKER_HOST=tcp://0.0.0.0:4243
      => Couldn't connect to Docker daemon at http://0.0.0.0:4243 - is it running?
    
    DOCKER_HOST=0.0.0.0:4243
      => Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 30, in main
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 236, in run
      File "/code/build/fig/out00-PYZ.pyz/fig.project", line 173, in up
      File "/code/build/fig/out00-PYZ.pyz/fig.service", line 255, in start_or_create_containers
      File "/code/build/fig/out00-PYZ.pyz/fig.service", line 69, in containers
      File "/code/build/fig/out00-PYZ.pyz/fig.packages.docker.client", line 432, in containers
      File "/code/build/fig/out00-PYZ.pyz/fig.packages.docker.client", line 69, in _get
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 395, in get
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 383, in request
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 481, in send
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 526, in get_adapter
    requests.exceptions.InvalidSchema: No connection adapters were found for 'localhost:4243/v1.12/containers/json'
    
    DOCKER_HOST=http:///var/run/docker.sock
       => Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 30, in main
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 21, in sys_dispatch
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 31, in dispatch
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 24, in dispatch
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.command", line 50, in perform_command
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.docopt_command", line 27, in perform_command
      File "/code/build/fig/out00-PYZ.pyz/fig.cli.main", line 236, in run
      File "/code/build/fig/out00-PYZ.pyz/fig.project", line 173, in up
      File "/code/build/fig/out00-PYZ.pyz/fig.service", line 255, in start_or_create_containers
      File "/code/build/fig/out00-PYZ.pyz/fig.service", line 69, in containers
      File "/code/build/fig/out00-PYZ.pyz/fig.packages.docker.client", line 432, in containers
      File "/code/build/fig/out00-PYZ.pyz/fig.packages.docker.client", line 69, in _get
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 395, in get
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 349, in request
      File "/code/build/fig/out00-PYZ.pyz/requests.sessions", line 287, in prepare_request
      File "/code/build/fig/out00-PYZ.pyz/requests.models", line 287, in prepare
      File "/code/build/fig/out00-PYZ.pyz/requests.models", line 341, in prepare_url
    requests.exceptions.InvalidURL: Invalid URL u'http:///var/run/docker.sock/v1.12/containers/json': No host supplied
    
    DOCKER_HOST=tcp://var/run/docker.sock
    # actually I found that in /var/run/ directory docker.sock present
     => Couldn't connect to Docker daemon at http://var/run/docker.sock - is it running?
    

    But this didn't solve my problem.
    Thanks for any help )

  6. rusllonrails commented on Aug 8, 2014

    @rusllonrails

    Found the solution. )

    1) Change the DOCKER_OPTS in /etc/default/docker to:
    DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"
    
    2) Restart docker
    sudo restart docker
    
    3) Make sure that docker is running on localhost:4243 
    $ netstat -ant  |grep 4243
    tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN
    
    4) Set DOCKER_HOST (.bashrc)
    export DOCKER_HOST=tcp://localhost:4243
    
    $ echo $DOCKER_HOST
    tcp://localhost:4243 
    
    5) And now
    $ fig run web rails new . --force --database=postgresql --skip-bundle
    

    NOTE, I have:

    Ubuntu 14.04
    Docker version 1.1.2, build d84a070
    Fig 0.5.2
    

    Thanks to http://serverascode.com/2014/05/25/docker-shipyard-multihost.html

  7. jonwhittlestone commented on Oct 21, 2014

    @jonwhittlestone

    Thanks @RuslanHamidullin

  8. JemiloII commented on Apr 29, 2015

    @JemiloII

    Just do:

    export DOCKER_HOST=/path/to/docker.sock

  9. SMalchenko commented on Sep 23, 2015

    @SMalchenko
  10. ashish-arora02 commented on Dec 11, 2015

    @ashish-arora02

    thanks @rusllonrails you saved my life.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions