-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grains/pillar not updated for docker_image #53401
Comments
Some concerns.
I've just test with registry.gitlab.com/gecube/salt-ssh:latest and run commands INSIDE container:
|
Hi gecube, We're talking about two different things. I'm using salt.states.docker_image.present (the sls option) to build docker images based on upstream images with salt states pre-applied. There is a Dockerfile for the upstream container image but it's not something involved in this step. This issue also occurs with the docker execution module: You get the host's grains instead of the container's grains. |
I'm able to replicate this. I also added this to the state:
and it returned the hostname from my laptop and not the container when running:
|
ZD-3884 |
A related issue is not being able to set pillars in docker_image.present as the docs describe
|
I ran it with
notice:
So it looks like grains works in the container, just not when jinja is using it. I had
as the sls and it printed
|
I think this is an issue with Jinja rendering... Running
and theabovestate.sls...
i see the following (snipped):
|
@terminalmage Hey Erik, are you the original author of this file? |
I wrote most of that code, but the code to build an image using SLS files was contributed by someone else and I'm not very familiar with it. |
I'm not entirely sure if this is a bug, it seems like it might be, but the problem here is definitely that the SLS file is not being rendered on the minion in question - it's being rendered outside the minion when the You can actually see the the correct grain is being shown within the docker container:
If you run with
|
Does this change fix things for everyone? |
Wow! Yes, that works swimmingly! So nice to have this working. Thank you Wayne. |
I'm still seeing this issue in 2019.2.2, after applying commit ea21006. Here are my SLS files.
sls_build/image_build.sls:
And the output when running
Versions report:
|
It occurred to me that using |
Ok, @clallen I am going to close the issue, but if you run into problems with it, again we can always open it, again. Thank you! |
Description of Issue
When running salt.state.docker_image.present the container being built has the host's pillar and grains instead of the container's. This is mostly an issue for detecting if the state is being run in a container via grains.virtual_subtype.
Setup
Steps to Reproduce Issue
Versions Report
The text was updated successfully, but these errors were encountered: