3
我試圖用我的Django應用程序創建一個Docker鏡像,但不幸的是我遇到了麻煩,試圖運行我的入口點腳本。docker-compose與Dokerfile入口點腳本衝突
泊塢退出eith碼錯誤127,並顯示以下信息:
/docker-entrypoint.sh:忽略/docker-entrypoint-initdb.d/*
你會發現下面的各自的配置文件:
Dockerfile
FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN mkdir -p /web/src
ADD . /web/src
WORKDIR /web/src
RUN pip install -U pip
RUN pip install -r requirements.txt -U
RUN chmod u+x docker-entrypoint.sh
ENTRYPOINT ["/bin/bash", "docker-entrypoint.sh"]
docker-entrypoint.sh
#!/bin/bash
python manage.py migrate
python manage.py collectstatic --noinput
touch /srv/logs/gunicorn.log
touch /srv/logs/access.log
tail -n 0 -f /srv/logs/*.log &
echo Starting Gunicorn...
exec gunicorn config.wsgi:application \
--name django_server \
--bind 0.0.0.0:8000 \
--workers 3 \
--log-level=info \
--log-file=/srv/logs/gunicorn.log \
--access-logfile=/srv/logs/access.log \
"[email protected]"
泊塢窗,compose.yml
version: '2.0'
services:
db:
container_name: db_server
image: postgres
web:
container_name: django_server
build: .
volumes:
- .:/web/src
environment:
- SECRET_KEY=k3jghf1jk%$JH^[email protected]@!MBMB<5=7DXXG)JHSX=
- PGDATABASE=postgres
- PGUSER=postgres
- PGPASSWORD=''
- PGHOST=db
- DJANGO_ENV=development
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
links:
- db
你在使用什麼操作系統?這是在一個虛擬機?你運行什麼命令來創建圖像? – jcfollower
操作系統:Ubuntu 14.04, 命令:docker-compose build –
你確定你不只是想做'docker build'嗎? – jcfollower