Re: Docker python sdk question | oracle database connection

From: sachin pawar <getsach_at_gmail.com>
Date: Tue, 31 Mar 2020 22:51:41 -0400
Message-ID: <CAA_xQWrWbZ-gZV8vNj_33Hqzg8hXpcKiZvux5MCDg3dxQK52SQ_at_mail.gmail.com>



Hi,

exec_run has to be run inside a container not in the client itself. You have to instantiate container with client.containers.get https://docker-py.readthedocs.io/en/stable/

Then you can call exec_run

https://docker-py.readthedocs.io/en/stable/containers.html

Rgds,
Sachin Pawar
https://twitter.com/sach_pwr

On Mon, Mar 30, 2020 at 10:09 AM kunwar singh <krishsingh.111_at_gmail.com> wrote:

> Hi Listers,
> I am trying to convert my call to oracle database in docker with python
> docker sdk
>
> *Docker cli command *:docker exec 4b3e6b612345
> /u01/app/oracle/product/12.0.0/dbhome_1/bin/sqlplus testuser/testpwd_at_orcl
> _at_run.sql
>
> *Python code:*
>
> >>> import docker
> >>> client = docker.from_env()
> >>>
> client.exec_run('4b3e6b612345',command='/u01/app/oracle/product/12.0.0/dbhome_1/bin/sqlplus
> testuser/testpwd_at_orcl _at_run.sql')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python3.6/site-packages/docker/client.py", line
> 205, in __getattr__
> raise AttributeError(' '.join(s))
> AttributeError: 'DockerClient' object has no attribute 'exec_run'
>
> OEL 7.7 is the OS
>
> Can you please suggest me if i am doing something wrong with the syntax.
> Still a newbie in python & docker , apologies in advance :)
>
> --
> Cheers,
> Kunwar
>

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 01 2020 - 04:51:41 CEST

Original text of this message