Docker Community Forums

Share and learn in the Docker community.

How to use exec_run in python docker sdk for replacing my docker cli command

Hi All,

I want to replace the below command with docker python sdk

docker exec 6d9c9b679541 /u01/app/oracle/product/12.0.0/dbhome_1/bin/sqlplus sachin/sachin@orcl @1.sql

here is code i am writing and the error i am getting using python3

>>> import docker
>>> client = docker.from_env()
>>> client.exec_run('6d9c9b679541',command='/u01/app/oracle/product/12.0.0/dbhome_1/bin/sqlplus sachin/sachin@orcl @1.sql')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/docker/", line 205, in __getattr__
    raise AttributeError(' '.join(s))
AttributeError: 'DockerClient' object has no attribute 'exec_run'

How to resolve this issue?