Docker Community Forums

Share and learn in the Docker community.

Docker with django

docker

(Cisse) #1

someone can help me please? I must run my django application in docker, so I have dowload ubuntu image, apache image, python image, mysql. Can I run ubuntu image first in container, after that can I run apache in container ubuntu? How can I do? Thanks for your answers.


(Sam) #2

a container is just like an OS…
you INSTALL software into it…

a Dockerfile (image build script)
from ubuntu

now at OS and utilities

install additional components

run apt-get install python apache mysql

now install your app.

entrypoint=[cmd and args]
must NOT end, when it ends, the container stops.

there may be better images in the docker catalog that would get you more software already configured
than the example i provided.

there is a django image (which says don’t use me anymore)

https://hub.docker.com/_/django/


(Vsupalov) #3

Take a look at this cookiecutter template: https://github.com/pydanny/cookiecutter-django

It can be configured to include docker-compose files and Dockerfiles to run a very solid Django Docker stack in development and production.

As you’re speaking of “running an image” - be sure that you get the basics of Docker before trying to make it work, otherwise you’ll have a much steeper learning curve figuring every misconception out as you go. Here’s an article which might help you get a quick overview.