I work on a private project that simulates a network of 3 hosts.
The projet hierarchy looks like that:
project
build
Dockerfile
code
main.py
docker-compose.yml
The Dockerfile has this line
WORKDIR /code
In docker-compose I have 3 services, which each represents a host (as described inthe first line).
I connect via ssh from host1 to host2
I use scp to copy a file to folder code:
scp.put("main.py", "code")
Then, I used ssh to run the file with python:
ssh.exec_command("python main.py")
I get this error:
python: can't open file '/root/main.py': [Errno 2] No such file or directory
If I set the working folder to code,
Where did the root folder came from?!