[Answered ]-How do you manage development tasks when setting up your development environment using docker containers?

1πŸ‘

At my current gig we setup a bash script called django_admin. You run it like so:

django_admin <management command>

Example:

django_admin syncdb

The script looks something like this:

docker run -it --rm  \
-e PYTHONPATH=/var/local \
-e DJANGO_ENVIRON=LOCAL \
-e LC_ALL=en_US.UTF-8 \
-e LANG=en_US.UTF-8 \
-v /src/www/run:/var/log \
-v /src/www:/var/local \
--link mysql:db \
localhost:5000/www:dev /var/local/config/local/django-admin $@

I’m guessing you could also hook something up like this to manage.py

πŸ‘€PizzaPanther

1πŸ‘

I normally wrap my actual CMD in a script that launches a bash shell. Take a look at Docker-Jetty container as an example. The final two lines in the script are:

/opt/jetty/bin/jetty.sh restart
bash

This will start jetty and then open a shell.

Now I can use the following command to enter a shell inside the container and run any commands or look at logs. Once I am done I can use Ctrl-p + Ctrl-q to detach from the container.

docker attach CONTAINER_NAME
πŸ‘€Usman Ismail

Leave a comment