Open bergmannf opened 7 years ago
@bergmannf
Thanks for using Ansible Container, and for taking the time to report this issue.
Ran across this while doing some 0.9.3 testing. There's definitely a conflict with the volume name /run/secrets
. To get around it, we changed the name we're using to /docker/secrets
, here in docker/engine.py.
If you run from source, the immediate issue should be resolved. Still need to do some testing to make sure that K8s secrets still work as expected.
I'd like to add this also affects when building on latest centos
containers. Namely I'm using docker.io/centos/systemd
. I'm running on a Fedora 27 host and /run/secrets/
now includes rhsm
data.
+1 for this issue still being there on CentOS 7.
Work around: edit /usr/lib/python2.7/site-packages/container/docker/engine.py For me it was line 210, but you can do a search for `os.path.join(os.sep, 'run', 'secrets') and that's the line you want to change. As @chouseknecht mentioned, changed the word run to docker.
@grantcurell and @dcode Are you using 0.9.2 or develop?
I tried it with 0.9.2 and the master branch. I couldn't get it to work so I tabled using ansible container for now. Hopefully @grantcurell fix works. I'll revisit it again soon.
The workaround worked for me in 0.9.2 on Fedora 27. It was line 201 for me.
@grantcurell i appreciate your answer, thanks for clarification.. i had same issue and i go to file:
/usr/lib/python2.7/site-packages/container/docker/engine.py
and change:
os.path.join(os.sep, 'run', 'secrets')
==> os.path.join(os.sep, 'docker', 'secrets')
ISSUE TYPE
container.yml
OS / ENVIRONMENT
SUMMARY
I stumbled over a problem of
ansible-container
not handling an already existing mount in/run/secrets
:Using
SUSE Linux Enterprise Server
there are patches in place that already inject a/run/secrets
folder into every running container with no way to prevent it.It seems that this will lead to an attempt to mount the volume twice when running any ansible-container configuration resulting in an error:
APIError: 500 Server Error: Internal Server Error ("linux mounts: Duplicate mount point '/run/secrets'")
.I already reported a bug to
SUSE
, but given that some docker upstream technology (e.g.docker swarm
) seems to use the same approach of mounting secrets into/run/secrets
it seems viable foransible-container
to handle an already existing mount.STEPS TO REPRODUCE
In theory reproduction under
SLES
just requires running any ansible-container file and it will break.To duplicate it without
SLES
building the containers with explicitly mounting another directory under/run/secrets
will simulate it and produce the same error.EXPECTED RESULTS
Instead of trying to mount
/run/secrets
twice, detect any existing mounts and just mount required secrets in sub-directories.ACTUAL RESULTS
See above.
A debug log of running
ansible-container --debug build
:https://gist.github.com/bergmannf/9905792accdb712011df7175ae4770ae