|
@@ -701,6 +701,12 @@ class Service(object):
|
|
|
|
|
|
build_opts = self.options.get('build', {})
|
|
build_opts = self.options.get('build', {})
|
|
path = build_opts.get('context')
|
|
path = build_opts.get('context')
|
|
|
|
+ # If build argument is not defined and there is no environment variable
|
|
|
|
+ # with the same name then build argument value will be None
|
|
|
|
+ # Moreover it will be sent to the docker engine as None and then
|
|
|
|
+ # interpreted as string None which in many cases will fail the build
|
|
|
|
+ # That is why we filter out all pairs with value equal to None
|
|
|
|
+ buildargs = {k: v for k, v in build_opts.get('args', {}).items() if v != 'None'}
|
|
# python2 os.path() doesn't support unicode, so we need to encode it to
|
|
# python2 os.path() doesn't support unicode, so we need to encode it to
|
|
# a byte string
|
|
# a byte string
|
|
if not six.PY3:
|
|
if not six.PY3:
|
|
@@ -715,7 +721,7 @@ class Service(object):
|
|
pull=pull,
|
|
pull=pull,
|
|
nocache=no_cache,
|
|
nocache=no_cache,
|
|
dockerfile=build_opts.get('dockerfile', None),
|
|
dockerfile=build_opts.get('dockerfile', None),
|
|
- buildargs=build_opts.get('args', None),
|
|
|
|
|
|
+ buildargs=buildargs,
|
|
)
|
|
)
|
|
|
|
|
|
try:
|
|
try:
|