我有一个python程序,它将输出文件存储在本地。现在,我的代码在docker容器中运行,我希望将生成的输出文件(如output.txt)移动到本地(停靠容器之外)。
我知道有一个命令可以将文件从docker传输到本地:
docker cp <containerId>:/file/path/within/container /host/path/target
#I tried like this inside docker container but it didn't work
os.system(sudo docker cp <containerId>:/
我的docker容器在虚拟机上工作得很好,我在主文件夹/home/myVM/Certificates中有相关的pfx证书和配置文件。在这个文件夹中,我有pfx证书文件和一个JSON配置。 我的docker compose定义了如下卷, volumes:
# Certificates folder should be present in the host VM with all certificates along with CertificateConfigurations.json
- "./Certificates:/app/certs:ro" 现在,当我
运行在docker容器中的浏览器需要向在我们网络中的测试API上运行的登录服务发送POST。该服务对帖子的来源非常挑剔,所以它拒绝了帖子,因为它来自host.docker.internal而不是localhost.company.com。 我不太可能将host.docker.internal添加到白名单中。 如果浏览器在我的本地机器上运行,那么POST将工作得很好,但是当浏览器在我的本地机器上的容器中运行时,该POST将失败。 我试过docker run --add-host='localhost.mycompany.com:127.0.0.1'和docker run --a