import docker# Initialize the Docker clientclient = docker.from_env()# Define Docker run optionsdocker_run_options = {'name': 'container-name','user': 'dafoamuser','mounts': [ {'type': 'bind','source': 'D:/Dafoam/oneraM6','target': '/home/dafoamuser/mount' } ],'working_dir': '/home/dafoamuser/mount','detach': True,'tty': True,'stdin_open': True,'command': 'bash'}# Run the Docker container with specified optionscontainer = client.containers.run('dafoamimage:latest', **docker_run_options)# Execute the mpirun command inside the containermpirun_command = 'mpirun -np 8 python runScript_v2.py 2>&1 | tee logOpt.txt'exec_cmd = container.exec_run(mpirun_command, tty=True, privileged=True)print(f"Command: {mpirun_command}\nOutput:\n{exec_cmd.output.decode('utf-8')}")# Stop and remove the container (if needed)container.stop()container.remove()
I am trying to execute a python script named runScript_v2.py inside container's shell using the above python script.But I get the following error:
C:\Users\yesbo\.conda\envs\py39env\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated"class": algorithms.Blowfish,Command: mpirun -np 8 python runScript_v2.py 2>&1 | tee logOpt.txtOutput:--------------------------------------------------------------------------mpirun was unable to find the specified executable file, and thereforedid not launch the job. This error was first reported for processrank 0; it may have occurred for other processes as well.NOTE: A common cause for this error is misspelling a mpirun command line parameter option (remember that mpirun interprets the first unrecognized command line token as the executable).Node: c537205732b5Executable: python--------------------------------------------------------------------------8 total processes failed to start
How can I fix this? From cmd I can run this mpirun command easily without any errors. But when I run my python script it gives me the error.