我有一个Dockerfile.aws.json
:
{
"AWSEBDockerrunVersion": "1",
"Ports": [{
"ContainerPort": "5000",
"HostPort": "5000"
}],
"Volumes": [{
"HostDirectory": "/tmp/download/models",
"ContainerDirectory": "/models"
}],
"Logging": "/var/log/nginx"
}
在.ebextensions/download.config
中,我有:
sources:
/tmp/download: https://example.com/models.zip
但是在我的容器中,/models
从未创建。我在做什么错了?
答案 0 :(得分:1)
我试图重复该问题,但未能成功。在我的测试中,Volumes
正常工作。
但是,您可以使用runlike工具进行一些故障排除,以检查用于实际运行容器的命令。该工具可让您检查EB是否正确安装了卷:
docker run --name = funny_driscoll --hostname = 628fc70a4331 --env = PORT = 8080 --env = PATH = / usr / local / sbin:/ usr / local / bin:/ usr / sbin:/ usr / bin:/ sbin:/ bin -volume = / tmp / fffff:/ models --expose = 8080 --restart = no --detach = true eb14d2391001 ./testapp
要使用它,请登录到EB实例并安装它:
sudo yum install python-pip
sudo pip install runlike
# check running container
sudo docker ps
# inspect the docker run command
runlike <container_id>
这将使您能够确认 docker run
是否正确包含--volume=
以及其他配置选项。