![](/img/trans.png)
[英]How can I stream a specific log file from multi-container Docker Elastic Beanstalk to CloudWatch?
[英]How can I mount a folder from the host to a Docker container with Elastic Beanstalk?
我有一個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
永遠不會被創建。 我究竟做錯了什么?
我試圖復制這個問題,但不能。 在我的測試中, Volumes
按預期工作。
但是,您可以使用runlike工具進行一些故障排除,以檢查用於實際運行容器的命令。 該工具允許您檢查 EB 是否正確安裝了卷:
docker 運行 --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=
以及其他配置選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.