How do I edit a file after I shell to a Docker container?

后端 未结 16 1898
你的背包
你的背包 2020-11-29 14:22

I successfully shelled to a Docker container using:

docker exec -i -t 69f1711a205e bash

Now I need to edit file and I don\'t have any edito

16条回答
  •  春和景丽
    2020-11-29 14:58

    You can just edit your file on host and quickly copy it into and run it inside the container. Here is my one-line shortcut to copy and run a Python file:

    docker cp main.py my-container:/data/scripts/ ; docker exec -it my-container python /data/scripts/main.py
    

提交回复
热议问题