def restore_image_options ( cli , image , options ) : dockerfile = io . StringIO ( ) dockerfile . write ( u'FROM {image}\nCMD {cmd}' . format ( image = image , cmd = json . dumps ( options [ 'cmd' ] ) ) ) if options [ 'entrypoint' ] : dockerfile . write ( '\nENTRYPOINT {}' . format ( json . dumps ( options [ 'entrypoint' ] ) ) ) cli . build ( tag = image , fileobj = dockerfile )
environment variables are not recognized in docker entrypoint python file
Restores CMD and ENTRYPOINT values of the image
def restore_image_options(cli, image, options):
    """ Restores CMD and ENTRYPOINT values of the image

    This is needed because we force the overwrite of ENTRYPOINT and CMD in the
    `run_code_in_container` function, to be able to run the code in the
    container, through /bin/bash.
    """
    dockerfile = io.StringIO()

    dockerfile.write(u'FROM {image}\nCMD {cmd}'.format(
        image=image, cmd=json.dumps(options['cmd'])))

    if options['entrypoint']:
        dockerfile.write(
            '\nENTRYPOINT {}'.format(json.dumps(options['entrypoint'])))

    cli.build(tag=image, fileobj=dockerfile)