'plexinc/pms-docker:%s' % opts.docker_tag]) != 0:
        print('Got an error when executing docker pull!')
        exit(1)

    account = None
    if not opts.unclaimed:
        if opts.token:
            account = MyPlexAccount(token=opts.token)
        else:
            account = plexapi.utils.getMyPlexAccount(opts)
    path = os.path.realpath(os.path.expanduser(opts.destination))
    makedirs(os.path.join(path, 'media'), exist_ok=True)
    arg_bindings = {
        'destination': path,
        'hostname': opts.server_name,
        'claim_token': account.claimToken() if account else '',
        'timezone': opts.timezone,
        'advertise_ip': opts.advertise_ip,
        'image_tag': opts.docker_tag,
        'container_name_extra': '' if account else 'unclaimed-'
    }

    docker_cmd = [c % arg_bindings for c in DOCKER_CMD]
    exit_code = call(docker_cmd)

    if exit_code != 0:
        exit(exit_code)

    print('Let`s wait while the instance boots...')
    start_time = time()
    server = None