ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 392 forks source link

Build image from scratch #873

Open etnbrd opened 6 years ago

etnbrd commented 6 years ago
ISSUE TYPE

Is it possible to build images from scratch with ansible-container ?

Based on this issue #52 mentionning an --from-scratch option, I am under the impression that it is possible, but can't find the relative documentation (no mention in the build documentation)

How could one provide a rootfs tarball instead of a base image, to build images from scratch ?

etnbrd commented 6 years ago

I was used to acbuild way of providing the tarball, and missed this issue #107 that specifies that the from directive from container.yml is equivalent to the FROM from a dockerfile.

So the way to do this with ansible-container and Docker would be to specify from: scratch, and then a role with the tarball.

Feel free to close this issue if this is correct.

j00bar commented 6 years ago

That's more or less accurate. I'd be interested to hear how this goes for you.

zvonkok commented 6 years ago

Trying to use from: scratch in container.yml , ansible-container tries to pull the scratch image, the scratch image used to be a regular image, but as of commit 8936789 it is a special case, and cannot be used with 'docker pull.' Failed to pull scratch: 500 Server Error: Internal Server Error ("'scratch' is a reserved name")

Did I miss something? Flag, configuration setting?

j00bar commented 6 years ago

Nope. You didn't miss anything - I did. Thanks for pointing me to that commit. sigh

My advice would be to roll your own scratch. It should be straightforward. Something like:

tar -czf - --files-from /dev/null | docker import - my-scratch

Good luck!

zvonkok commented 6 years ago

Thanks, my-scratch looks good, have used tianon/true for testing. I get this error when trying to apply any role to the my-scratch or tianon/true image:

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

My role just tries to copy some file into the container.