Simply running the example code from the main page:
import docker
client = docker.from_env()
client.containers.run("ubuntu:latest", "echo hello world")
AttributeError: 'function' object has no attribute 'run'
it imports fine, I get a
You're using 1.x, the example is for 2.x
pip uninstall docker-py && pip install -U docker
Most helpful comment
You're using 1.x, the example is for 2.x
pip uninstall docker-py && pip install -U docker