Docker Community Forums

Share and learn in the Docker community.

Attributerror docker import


(Widyanjani) #1

so i have a python file like this :
import docker
client = docker.from_env()
client.containers.run(“ubuntu”, “echo hello world”)

and then i try to run the python file but i got error like this :
Traceback (most recent call last):
File “api.py”, line 3, in
client.containers.run(“ubuntu”, “echo hello world”)
AttributeError: ‘function’ object has no attribute ‘run’

what’s the problem? please help me asap, thankyou