Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Handle image not found #469

Open
chouseknecht opened this issue May 1, 2017 · 9 comments
Open

Handle image not found #469

chouseknecht opened this issue May 1, 2017 · 9 comments
Assignees
Labels

Comments

@chouseknecht
Copy link
Contributor

ISSUE TYPE
  • Bug Report
container.yml
version: "2"
settings:
  conductor_base: debian:stretch-slim
services:
  web:
    from: nginx
    roles:
      - trivial

registries: {}
SUMMARY

See the discussion at https://groups.google.com/forum/#!topic/ansible-container/ItpBPMVFKQY

When the from image for a service does not match the conductor base image, it fails to pull the from image.

Specifically, right after line 624 of container/core.py, we fail to handle the possibility that the image may be None.

@chouseknecht
Copy link
Contributor Author

Here's the actual error reported by the user:

$ ansible-galaxy init -p roles trivial
$ ansible-container build

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=quickstart
Building service...	project=quickstart service=web
Traceback (most recent call last):
  File "/usr/local/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 349, in conductor_commandline
    **params)
  File "/_ansible/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/_ansible/container/core.py", line 682, in conductorcmd_build
    container_id = engine.run_container(cur_image_id, service_name, **run_kwargs)
  File "/_ansible/container/docker/engine.py", line 81, in __wrapped__
    return fn(self, *args, **kwargs)
  File "/_ansible/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/_ansible/container/docker/engine.py", line 189, in run_container
    **run_kwargs
  File "/usr/local/lib/python2.7/dist-packages/docker/models/containers.py", line 666, in run
    container.start()
  File "/usr/local/lib/python2.7/dist-packages/docker/models/containers.py", line 312, in start
    return self.client.api.start(self.id, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/container.py", line 1068, in start
    self._raise_for_status(res)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 216, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/docker/errors.py", line 30, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("linux spec user: unable to find user root: no matching entries in passwd file")
Conductor terminated. Cleaning up.	command_rc=1 conductor_id=87f520d6d93a7b5d82fcdc43066ee844dd03c3831421ad361e883f23f9525936 save_container=False
ERROR	Conductor exited with status 1

@chouseknecht
Copy link
Contributor Author

It turns out, after reviewing this with @j00bar, that the intention is for AC to not pull images. So I think the work here is:

  • Gracefully handle the error above, such that we show a sensible text message with instructions, and not a stack trace.
  • Update our documentation, making sure that it's obvious to users that we don't pull base images.

@lorin
Copy link

lorin commented May 5, 2017

@chouseknecht What about for the base image of the conductor? Will Ansible Container automatically pull that, or is it the user's responsibility to pull the image first?

@Voronenko
Copy link
Contributor

Voronenko commented May 23, 2017

UPD:

Ok, for those interested, it most likely issue in ansible-container logic, but workaround is to docker pull service base image BEFORE ansible-container build command.

But would be cool to validate image existance in advance, and provide better user guidance.

============================================

I also experience the same issue.

Demo case:

I build alpine php-enabled user:

conductor_base: alpine:3.5
...
   php:
     from: alpine:3.5
     roles:
       - softasap.sa-php-container

builds and works like a charm, but when I try

conductor_base: debian:jessie
...
   php:
     from: php:5.6.30-fpm
     roles:
       - softasap.sa-php-container

I get the error:

docker.errors.APIError: 500 Server Error: Internal Server Error ("linux spec user: unable to find user root: no matching entries in passwd file")

Any ideas how to deal right ?

@remyleone
Copy link

I'm also affected by this.

@cs2629207
Copy link

I had just received this error as well. Indeed @Voronenko if we pull the images before we run the build command then it gets past this error.

@chouseknecht
Copy link
Contributor Author

@cs2629207

Thanks for your feedback on this issue.

I'm curious what version of Ansible Container you're running. I thought we addressed this issue in PR #645

To get that update you would need to be running from source.

@Voronenko
Copy link
Contributor

@chouseknetch , if you believe it is fixed, make sure you closed issue here as well, once you release pypi version.

@chouseknecht
Copy link
Contributor Author

@Voronenko

Agreed. Was hoping to get you or another commenter on this issue to test and confirm that we're pulling images as expected. We probably also need to update docs.

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

No branches or pull requests

6 participants