Open chouseknecht opened 7 years ago
To my knowledge, this is NOTABUG.
ContainerConfig
is metadata the Docker engine relies upon during the rebuild process. The Config
section is what the actual runtime defaults are for the container image. So long as Config.Cmd
is correct, the behavior is correct.
It does appear that the image that Ansible Container creates has a blank CMD field if there's no "command" field explicitly specified in container.yml:
For example, here's the original image:
$ docker inspect nginx | jq '.[0].Config.Cmd'
[
"nginx",
"-g",
"daemon off;"
]
Here's the one generated by Ansible Container when no "command" is specified:
$ docker inspect ans-con-ac-nginx | jq '.[0].Config.Cmd'
[
""
]
Agreed - thank you, and apologies for my misunderstanding.
In container.utils:metadata_to_image_config
, we're starting with blank defaults for every configuration string. We should pull the settings instead from the from:
image.
Thank you for reporting this!
same goes for entrypoint
+1
Hi all:
I've noticed that when I use Ansible Container to build an image, it does not preserve the CMD of the base image.
For example, if I use "nginx" as my base image, the CMD of the original image is:
Or, if we inspect it:
If I create a new image from nginx using an entry like this:
Then, in the image generated by Ansible Container, CMD becomes:
(I assume that's from here).
I can work around this by explicitly adding a "command" field to the service entry:
However, it wasn't obvious to me what the issue was. I think it would be a useful feature if Ansible Container preserved the CMD of the parent image by default.