Skip to content

Docker driver - include rootless support in default Dockerfile.j2? #312

@liamjones

Description

@liamjones

I'm trying to apply the docker rootless setup across all of our molecule tests so that missing privilege escalation on tasks is picked up earlier than actual deployment.

Since I want to apply this to all of my tests, I'd like to be able to make a change/define it in one place (e.g. somewhere like ~/.config/molecule/config.yml) as a default that could be overridden on a test-by-test basis. I can do this for the ansible_user, but the docker driver only looks for custom Dockerfile.j2 templates relative to the molecule scenario directory, and the path is picked up off platforms[*].dockerfile, so it's a little more awkward to do globally:

path: "{{ molecule_scenario_directory + '/' + (item.dockerfile | default('Dockerfile.j2')) }}"

What do you think about adding the extra ansible user & sudo config to the default Dockerfile.j2? Either always applied (it shouldn't break the default behaviour of running as root) or behind some kind of flag that could be passed to the driver?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions