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

Docker image path in private GitLab registry not so clean #826

Open huge-metal-fan opened 6 years ago

huge-metal-fan commented 6 years ago
ISSUE TYPE
OS / ENVIRONMENT
self-hosted GttLab CE with private Docker registry
automated docker image build
ansible-container
SUMMARY

When I use toolset mentioned in environment section I've got docker images paths like: https://my-self-hosted-gitlab.com/project/subproject/project-docker_image:tag. Because of settings.project_name param in container.yaml which either set or directory name. So I've got duplicate {{ project }} in docker image path. It violates DRY principle I think.

chouseknecht commented 6 years ago

@huge-metal-fan

Thanks for your interest in Ansible Container. We appreciate you taking the time to open an issue.

Just so I can better understand, and maybe solve this, could you please share your container.yml file. I think you're referring to the registry section, and it would be helpful to have an example.

Thanks!

chouseknecht commented 6 years ago

@huge-metal-fan

What you may be referring to is pushing images to your private registry, and Ansible Container inserting the project_name into the image path.

The code where this happens is here: https://github.com/ansible/ansible-container/blob/develop/container/docker/engine.py#L907

Notice in that code, there is an override called repository_prefix. You can set that to '', if you don't want project_name, or an alternative, added to the name.

Documentation for registry settings can be found here: http://docs.ansible.com/ansible-container/container_yml/reference.html#registries.

Hopefully that helps.

treyd commented 6 years ago

@huge-metal-fan would you mind sharing info about your automated docker image build, if you're accomplishing it with .gitlab-ci.yml and gitlab-runner? I'm trying to get something similar working but I am running into more problems before I even get as far as pushing an image.

Apologies all if this takes the issue off-topic.