Dariusz Krynicki
Dariusz Krynicki

Reputation: 2718

client error with docker-py running on windows

I am using docker-py version 4.0.2. I am running on Windows and I have not installed docker as I do not have an access to root.

This is my code:

import docker
from io import BytesIO

dockerfile = '''
# Shared Volume
VOLUME /data
CMD ["/bin/sh"]
'''
f = BytesIO(dockerfile.encode('utf-8'))
cli = docker.DockerClient(base_url='tcp://0.0.0.0:2375')
cli.images.build(path='github.com/docker-library/redis', fileobj=f, rm=True, tag='yourname/volume')

It gives me:

docker.errors.APIError: 403 Client Error: URLBlocked-Uncategorised

I do assume it is sth to do with base_url and docker service not running on my machine. Is it possible to create docker service by pulling it from github repo and spinning it or using python to spin docker service if I understand it correctly?

Upvotes: 2

Views: 587

Answers (1)

Stefano
Stefano

Reputation: 5076

[docker-py] is a Python library for the Docker Engine API. It lets you do anything the docker command does, but from within Python apps – run containers, manage containers, manage Swarms, etc.

src: https://github.com/docker/docker-py

I'm afraid you need the docker service running to have the library working. Unfortunately, due to the possibilities that docker offers you, I don't think it's possible to install it without the admin superpowers. If you can manage to have a VM installed you can run your tests on there (but it won't be a pleasant experience).

Upvotes: 1

Related Questions