INNER CODE UNIT · Python

_remove_existing_container

ChrispyBacon-dev/DockFlare · dockflare-agent/app/main.py:295

def _remove_existing_container(client):
    global tunnel_container, current_tunnel_version
    try:
        existing_container = client.containers.get('dockflare-agent-tunnel')
        logging.info(f"Stopping existing cloudflared container '{existing_container.name}' ({existing_container.short_id}).")
        existing_container.stop()
        existing_container.remove()
        if tunnel_container and tunnel_container.id == existing_container.id:
            tunnel_container = None
    except docker.errors.NotFound:
        logging.info("No existing cloudflared container to remove.")
    except Exception as e:
        logging.error(f"Failed to remove existing cloudflared container: {e}")
    finally:
        current_tunnel_version = None


def _run_cloudflared_container(client, tunnel_name, tunnel_token):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…