You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cast issue on int64 after variable interpolation in docker-compose.yml #2730
I don't know of a good way to handle problem at this time, but I think it's something that does need to be fixed. We have the same issue with boolean fields.
Just trying to discover the code and see how this could be fixed.
Using Json Schema info
In service_schema_v1.json the cpu_shares is defined as
"cpu_shares": {"type": ["number", "string"]},
I am not sure why "string" is accepted, based on what I can see in the docker rundoc it should not be the case (but I may very well have missed something).
I am asking because, if we had a single type in the schema, it could probably be used to do some automatic cast after the interpolation :
get the type of the field from the schema
do the cast from String as needed
The conversion could also be done as an error handler for the jsonschema validator, but I like the idea that the "automatic cast" is only applied for "interpolated variables".
Add conversion hint in the source template
An other option would be to add some hints in the templatised config file (ex cpu_shares: int:${CPU_SHARES}), but this does not seems like a clean approach (+ it is redundant info).
changed the title [-]Cast issue on int64 after variable interpolation in docker-compose.xml[/-][+]Cast issue on int64 after variable interpolation in docker-compose.yml[/+]on Feb 9, 2016
Activity
dnephin commentedon Jan 22, 2016
I don't know of a good way to handle problem at this time, but I think it's something that does need to be fixed. We have the same issue with boolean fields.
tiry commentedon Jan 25, 2016
Just trying to discover the code and see how this could be fixed.
Using Json Schema info
In
service_schema_v1.jsonthecpu_sharesis defined asI am not sure why
"string"is accepted, based on what I can see in thedocker rundoc it should not be the case (but I may very well have missed something).I am asking because, if we had a single type in the schema, it could probably be used to do some automatic cast after the interpolation :
The conversion could also be done as an error handler for the jsonschema validator, but I like the idea that the "automatic cast" is only applied for "interpolated variables".
Add conversion hint in the source template
An other option would be to add some hints in the templatised config file (ex
cpu_shares: int:${CPU_SHARES}), but this does not seems like a clean approach (+ it is redundant info).Issue docker#2730 - better handle types for expanded variables
Issue docker#2730 - better handle types for expanded variables
Issue docker#2730 - better handle types for expanded variables
Issue docker#2730 - better handle complex interpolations
Issue docker#2730 - better handle complex interpolations
Issue docker#2730 - better handle complex interpolations
[-]Cast issue on int64 after variable interpolation in docker-compose.xml[/-][+]Cast issue on int64 after variable interpolation in docker-compose.yml[/+]Issue docker#2730 - better handle types for expanded variables
Issue docker#2730 - better handle complex interpolations
Issue docker#2730 - better handle complex interpolations
Issue docker#2730 - better handle complex interpolations
Issue docker#2730 - better handle complex interpolations
wu0407 commentedon Apr 7, 2017
the similar problem,if i set
docker-compose up end up
docker version
docker-compose version
shouze commentedon Jul 3, 2017
@shin- @dnephin it's been a long time about that related issues of that kind.
From now, will need to adapt in docker-compose & in go compose lib integrated into docker codebase.
But prior to that, is there any consensus about casting variables or not according to schema types?