I'm trying to run a shell command with docker-py on an already-running container, but get an error:
exec: "export": executable file not found in $PATH
here's how I wrote the script:
exe = client.exec_create(container=my_container, cmd='export MYENV=1')
res = client.exec_start(exec_id=exe)
so my question is how can I run a shell command (inside the container) using docker-py?
bash -c) then the variable would be exported in the child process, but no where else. Maybe useos.environ[MYENV] = '1'?os.environ[MYENV]inside the container here?exportwas just an example, I want to run a shell command inside the container. I finally need to set an env variable inside the container and run psql inside the container (then obviously run some queries). but first step is to run the shell command itself inside the container using docker-py. Also not sure how to prefixbash -cvia docker-py andexec_createcmd='bash -c "export MYENV=1"'environmentparameter ofdocker.client.containers.runto set environment variables.