【发布时间】:2015-11-02 14:31:57
【问题描述】:
看着这个blog - 5. Create Dockerfile。看来我必须在 Docker.io 上创建一个指向我的私有映像的新 Dockerfile。
而且由于最后一个命令应该是启动一个可执行文件,否则 docker 镜像将最终进入 nirvana,最后有 supervisrd:
FROM flux7/wp-site # This is the location of our docker container.
RUN apt-get install supervisor
RUN mkdir -p /var/log/supervisor
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 80
CMD supervisord -c /etc/supervisor/conf.d/supervisord.conf
这让我有点困惑,因为我有一个经过全面测试的自定义 Docker 映像,以 supervisord 结尾,见下文:
FROM ubuntu:14.04.2
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get -y update && apt-get upgrade -y
RUN apt-get install supervisor python build-essential python-dev python-pip python-setuptools -y
RUN apt-get install libxml2-dev libxslt1-dev python-dev -y
RUN apt-get install libpq-dev postgresql-common postgresql-client -y
RUN apt-get install openssl openssl-blacklist openssl-blacklist-extra -y
RUN apt-get install nginx -y
RUN pip install "pip>=7.0"
RUN pip install virtualenv uwsgi
RUN mkdir -p /var/log/supervisor
ADD canonicaliser_api /home/ubuntu/canonicaliser_api
ADD config_local.py /home/ubuntu/canonicaliser_api/config/config_local.py
RUN virtualenv /home/ubuntu/canonicaliser_api/venv
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && pip install -r /home/ubuntu/canonicaliser_api/requirements.txt
RUN export CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && cd /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/ && python setup.py build_ext --inplace
RUN cp /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/canonicaliser/cython_extensions/*.so /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions
RUN rm -rf /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/canonicaliser
RUN rm -r /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/build
RUN mkdir /var/run/flask-uwsgi
RUN chown -R www-data:www-data /var/run/flask-uwsgi
RUN mkdir /var/log/flask-uwsgi
ADD flask-uwsgi.ini /etc/flask-uwsgi/
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 8888
CMD ["/usr/bin/supervisord"]
那么我如何提供我的自定义图像(CMD?)而不是使用supervisord?除非我忽略了什么......
更新
我已应用建议的更新,但无法通过 DockerHub 上的私有 repo 进行身份验证。
[2015-08-11T14:02:10.489Z] INFO [1858] - [CMD-Startup/StartupStage0/AppDeployPreHook/03build.sh] : Activity execution failed, because: WARNING: Invalid auth configuration file
Pulling repository houmie/canon
time="2015-08-11T14:02:08Z" level="fatal" msg="Error: image houmie/canon:latest not found"
Failed to pull Docker image houmie/canon:latest, retrying...
WARNING: Invalid auth configuration file
S3 存储桶内名为docker 的文件夹中的dockercfg 是
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "xxxx",
"email": "xxx@gmail.com"
}
}
}
Dockerrun.aws.json 是:
{
"AWSEBDockerrunVersion":"1",
"Authentication":{
"Bucket":"dd-xxx-ir-01",
"Key":"docker/dockercfg"
},
"Image":{
"Name":"houmie/canon",
"Update":"true"
},
"Ports":[
{
"ContainerPort":"8888"
}
]
}
【问题讨论】:
标签: python amazon-web-services docker amazon-elastic-beanstalk