Hey everyone! I'm really new to both Docker and Linux and could use some guidance. I need to run a Python script named "script.py" in an existing Docker container called "pytorch." I'm accessing this Docker container on a remote machine using SSH through the Windows command prompt. Can anyone explain how I can upload my script to the container and get it to run? I'd love to see the output saying "hello world" in my command prompt. Thanks in advance!
2 Answers
You might also consider just copying the script directly into the container. You can use the `docker cp` command followed by your script path and the container name. After copying, you can exec into the container and run your script as usual!
It sounds like you'll need to make sure your script is accessible to the container. One way to do this is by creating a bind mount when you start the container, which lets you share a file from your local machine to the container's filesystem. First, you can use the command `docker exec -it pytorch /bin/bash` to get a shell inside the container. From there, you can run your script! Just remember to make sure the script is in the right location in the container before you try to execute it.
So just to clarify, do I need to start the container with some specific commands to make the script available?

Thanks! Could you provide a sample command for using `docker cp`?