Details

    • Type: Task
    • Status: Open
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: dcos-e2e
    • Labels:

      Description

      If using the Docker backend or the Docker CLI, for some reason a Docker build fails, the error is inscrutible.

      Reproduce this by running:

      echo "RUN foobar" >> src/dcos_e2e/backends/_docker/resources/dockerfiles/base/centos-7/Dockerfile
      

      And then running:

      Traceback (most recent call last):
        File "/Users/Adam/.virtualenvs/e2e/bin/dcos-docker", line 11, in <module>
          load_entry_point('DCOS-E2E', 'console_scripts', 'dcos-docker')()
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/click/core.py", line 722, in __call__
          return self.main(*args, **kwargs)
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/click/core.py", line 697, in main
          rv = self.invoke(ctx)
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
          return _process_result(sub_ctx.command.invoke(sub_ctx))
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/click/core.py", line 895, in invoke
          return ctx.invoke(self.callback, **ctx.params)
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/click/core.py", line 535, in invoke
          return callback(*args, **kwargs)
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
          return f(get_current_context(), *args, **kwargs)
        File "/Users/Adam/Documents/mesosphere/dcos/dcos-e2e/src/cli/dcos_docker/commands/create.py", line 463, in create
          public_agents=public_agents,
        File "/Users/Adam/Documents/mesosphere/dcos/dcos-e2e/src/dcos_e2e/cluster.py", line 62, in __init__
          cluster_backend=cluster_backend,
        File "/Users/Adam/Documents/mesosphere/dcos/dcos-e2e/src/dcos_e2e/backends/_docker/__init__.py", line 326, in __init__
          docker_version=cluster_backend.docker_version,
        File "/Users/Adam/Documents/mesosphere/dcos/dcos-e2e/src/dcos_e2e/backends/_docker/_docker_build.py", line 76, in build_docker_image
          buildargs={'DOCKER_URL': docker_urls[docker_version]},
        File "/Users/Adam/.virtualenvs/e2e/lib/python3.7/site-packages/docker/models/images.py", line 266, in build
          raise BuildError(chunk['error'], result_stream)
      docker.errors.BuildError: The command '/bin/sh -c foobar' returned a non-zero code: 127
      

      The cause of the error is hidden in the build log:

      (Pdb++) foo = [item for item in exc.build_log]
      (Pdb++) foo
      [{'stream': 'Step 1/6 : FROM mesosphere/dcos-docker:base'}, {'stream': '\n'}, {'stream': ' ---> ea80130b4fbb\n'}, {'stream': 'Step 2/6 : ENV TERM xterm'}, {'stream': '\n'}, {'stream': ' ---> Using cache\n'}, {'stream': ' ---> 42d64e6b50c2\n'}, {'stream': 'Step 3/6 : ENV LANG en_US.UTF-8'}, {'stream': '\n'}, {'stream': ' ---> Using cache\n'}, {'stream': ' ---> 417d69880d7c\n'}, {'stream': 'Step 4/6 : ARG DOCKER_URL'}, {'stream': '\n'}, {'stream': ' ---> Using cache\n'}, {'stream': ' ---> 1d392d0fe530\n'}, {'stream': 'Step 5/6 : RUN curl -sSL --fail "${DOCKER_URL}" | tar xvzf - -C /usr/bin/ --strip 1 \t&& chmod +x /usr/bin/docker* \t&& (getent group nogroup || groupadd -r nogroup) \t&& (getent group docker || groupadd -r docker) \t&& (gpasswd -a "root" docker || true) \t&& rm -f /etc/securetty \t&& ln -vf /bin/true /usr/sbin/modprobe \t&& ln -vf /bin/true /sbin/modprobe'}, {'stream': '\n'}, {'stream': ' ---> Using cache\n'}, {'stream': ' ---> 5f68614d7afa\n'}, {'stream': 'Step 6/6 : RUN foobar'}, {'stream': '\n'}, {'stream': ' ---> Running in 4579aef29895\n'}, {'stream': '\x1b[91m/bin/sh: foobar: command not found\n\x1b[0m'}, {'stream': 'Removing intermediate container 4579aef29895\n'}, {'errorDetail': {'code': 127, 'message': "The command '/bin/sh -c foobar' returned a non-zero code: 127"}, 'error': "The command '/bin/sh -c foobar' returned a non-zero code: 127"}]
      

      In this case:

      /bin/sh: foobar: command not found
      

      We should show these errors when a build fails as this will make debugging easier.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                adamdangoor Adam Dangoor (Inactive)
                Team:
                Mesosphere
                Watchers:
                Adam Dangoor (Inactive)
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: