File size: 698 Bytes
073e0da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import subprocess

def download_docker_image(image_name=, tag='latest', destination='/tmp/hello-world'):
    try:
        command = [
            'skopeo', 'copy',
            f'docker://docker.io/{image_name}:{tag}',
            f'dir:{destination}'
        ]
        subprocess.run(command, check=True)
        print(f"Image '{image_name}:{tag}' downloaded successfully to {destination}.")
    except subprocess.CalledProcessError as e:
        print(f"Error downloading image: {str(e)}")

# Example usage
image_name = 'mintplexlabs/anythingllm'  # Use 'library' for official images
tag = 'latest'
destination = '/tmp/mintplexlabs_anythingllm'
download_docker_image(image_name, tag, destination)