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

Show docker-compose logs upon initialisation failure #9

Open
estahn opened this issue Apr 7, 2017 · 1 comment
Open

Show docker-compose logs upon initialisation failure #9

estahn opened this issue Apr 7, 2017 · 1 comment

Comments

@estahn
Copy link

estahn commented Apr 7, 2017

Dockerspec Version

0.4.1

Ruby Version

2.4

Platform Details

Mac

Scenario

docker-compose fails to initialise one of the containers

Steps to Reproduce

Use a container that fails to initialise (e.g. busybox with a non-existing command)

Expected Result

dockerspec should fail and provide useful information, e.g. docker-compose logs of the failed container.

Actual Result

Just fails with no specific information.

@zuazo
Copy link
Owner

zuazo commented Apr 18, 2017

@estahn as always, thanks for the report 😉

Please, could you add a complete docker-compose.yml example, the current output and the expected output?

For example, I have tried the following docker-compose.yml:

version: '2'

services:
  busybox:
    image: busybox
    command: badcommand

And the following spec/test_spec.rb file:

require 'dockerspec/serverspec'

describe docker_compose('docker-compose.yml', wait: 5) do
  its_container(:busybox) do
    describe file('/etc/passwd') do
      it { should be_file }
    end
  end
end

The error running docker-compose up:

$ docker-compose up
Creating tmp_busybox_1

ERROR: for busybox  Cannot start service busybox: oci runtime error: container_linux.go:247: starting container process caused "exec: \"badcommand\": executable file not found in $PATH"
ERROR: Encountered errors while bringing up the project.

And dockerspec returns exactly the same error:

$ rspec
/home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-api-1.33.4/lib/docker/connection.rb:46:in `rescue in request': oci runtime error: container_linux.go:247: starting container process caused "exec: \"badcommand\": executable file not found in $PATH" (Docker::Error::NotFoundError)

        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-api-1.33.4/lib/docker/connection.rb:38:in `request'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-api-1.33.4/lib/docker/connection.rb:65:in `block (2 levels) in <class:Connection>'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-api-1.33.4/lib/docker/container.rb:202:in `start!'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-api-1.33.4/lib/docker/container.rb:216:in `public_send'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-api-1.33.4/lib/docker/container.rb:216:in `block (2 levels) in <class:Container>'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-compose-api-1.1.5/lib/docker-compose/models/compose_container.rb:222:in `start'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-compose-api-1.1.5/lib/docker-compose/models/compose.rb:117:in `block in call_container_method'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-compose-api-1.1.5/lib/docker-compose/models/compose.rb:116:in `each'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-compose-api-1.1.5/lib/docker-compose/models/compose.rb:116:in `call_container_method'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/docker-compose-api-1.1.5/lib/docker-compose/models/compose.rb:70:in `start'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/specinfra-backend-docker_compose-0.1.0/lib/specinfra/backend/docker_compose.rb:198:in `do_start'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/specinfra-backend-docker_compose-0.1.0/lib/specinfra/backend/docker_compose.rb:50:in `block in initialize'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/specinfra-backend-docker_compose-0.1.0/lib/specinfra/backend/docker_compose.rb:50:in `chdir'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/specinfra-backend-docker_compose-0.1.0/lib/specinfra/backend/docker_compose.rb:50:in `initialize'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/specinfra-2.67.8/lib/specinfra/backend/base.rb:8:in `new'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/specinfra-2.67.8/lib/specinfra/backend/base.rb:8:in `instance'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine/specinfra/backend.rb:131:in `backend_instance'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine/specinfra/backend.rb:58:in `save'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine/specinfra.rb:72:in `when_running'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine_list.rb:147:in `block in call_engines_method'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine_list.rb:147:in `map'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine_list.rb:147:in `call_engines_method'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/engine_list.rb:102:in `when_running'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/runner/base.rb:230:in `when_running'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/runner/compose.rb:116:in `run'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/dockerspec-0.4.1/lib/dockerspec/rspec/resources.rb:436:in `docker_compose'
        from /home/dockertests/tmp/spec/test_spec.rb:3:in `<top (required)>'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/bin/rspec:22:in `load'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/bin/rspec:22:in `<main>'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/bin/ruby_executable_hooks:15:in `eval'
        from /home/dockertests/.rvm/gems/ruby-2.4.0@tmp/bin/ruby_executable_hooks:15:in `<main>'

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

2 participants