4๐
I suggest to use yml file and docker compose. Below is a template to get you started:
[Dockerfile]
FROM python:2.7
RUN pip install Django
RUN mkdir /code
WORKDIR /code
COPY code/ /code/
where your files are located in code directory.
[docker-compose.yml]
version: '2'
services:
db:
image: mysql
web0:
build: .
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
depends_on:
- db
There might be a problem with your working directory path defined in Dockerfile. Hope above helps.
๐คsalehinejad
3๐
Solution provided by salehinejad seems to be good enough ,although i have not tested it personally but if you do not want to use yml file and want to go your way then you should expose the port by adding
-p 0:8000
in your run command
So your should look like this :
docker run -p 0:8000 --link mysqlapp:mysql -d app
๐คemme
- [Django]-Import Error: no module named transaction
- [Django]-Django Celery Redis
- [Django]-How to create different objects depending on input?
- [Django]-Django: object needs to have a value for field "โฆ" before this many-to-many relationship can be used
- [Django]-How to restrict access for staff users to see only their information in Django admin page?
0๐
I suspect you have not told Docker to talk to your VM, and that your containers are running on your host machine (if you can access at localhost, this is the issue).
Please see this post for resolution:
๐คzachdb86
- [Django]-Testing django with mongoengine
- [Django]-How to create an object for a model from the console similar to how Django made the createsuperuser command
- [Django]-Error in shell: doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
- [Django]-How to use a different database for Heroku review apps?
Source:stackexchange.com