Open moonbass630 opened 3 years ago
Your code sample would be much more readable if you used code block formatting, by putting ```
before and after the code. I also hope that the passwords you included in the sample are not used in production.
I cant pinpoint where your issue is, exactly, but your docker-compose file is mapping the src
folder to /code
, where the dockerfile has already installed a bunch of stuff. I'm not sure where pip installs things by default, but if it uses the current directory, that might be the reason. You are effectively hiding the containers own /code
directory by mapping in ./src
from your host machine.
That's my best bet. I hope you find a way to solve your problem.
I am faced with the error below. I have no idea to solve it. If anyone knows the solution, please help me...
Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"django-admin.py\": executable file not found in $PATH": unknown
■docker-compose.yml `version: "3" services: nginx: image: nginx:1.13 ports:
python
db: image: mysql:5.7
MySQLの文字コードの設定です(defaultはlatin1が入っており、日本語入力ができないため)
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci ports:
./sqlを/docker-entrypoint-initdb.dにマウントすることで、コンテナ起動時に./sql配下のsql文が実行される(DBの初期化)
./sql:/docker-entrypoint-initdb.d
python: build: ./python
uwsgiを使用してポート8001(任意のポート番号)を開放します。これが、後のnginxへの連携の際に必要な処理となります
app.wsgiのappはDjangoのプロジェクト名です
--py-autoreload 1はDjangoアプリ開発の際に、ファイル等に変更があった際は自動リロードするための設定です
--logto /tmp/mylog.logはログを残すための記述です。
command: uwsgi --socket :8001 --module app.wsgi --py-autoreload 1 --logto /tmp/mylog.log volumes:
■Dockerfile `#python3をインストール FROM python:3
PYTHONUNBUFFEREDでバッファーを無効にするらしい
ENV PYTHONUNBUFFERED 1
RUN mkdir /code WORKDIR /code COPY requirements.txt /code/ RUN /bin/sh -c pip install -r requirements.txt COPY . /code`