-1
I’m using the Docker-py in version 3.7 of Python and when I try to execute the function that uses it an Attributeerror is returned
My code:
from django.shortcuts import render
from django.http import HttpResponse
import docker
# Create your views here.
def index(Request):
client = docker.Client(base_url='unix://var/run/docker.sock')
events = objdocker.events()
for event in events:
return HttpResponse(event)
# and cancel from another thread
events.close()
Error received:
Attributeerror at /Docker/ module 'Docker' has no attribute 'Client'
ps. I have tried using version 2.7 of Python thinking that the Docker api would better accept Docker, but it is not compatible.
And what documentation did you use as a basis? current, in fact, there is no class called
Client
and yes there is a callDockerClient
.– Woss
I used this link https://docker-py.readthedocs.io/en/stable/client.html but I saw on some forums that Docker. Client is more current, however in both cases the error persists.
– piresthiago10