General Docker Tips & Tricks
Designate your Docker Development Server IP
When
DEBUG
is set to
True
, the host is validated against
['localhost', '127.0.0.1', '[::1]']
. This is adequate for most cases..
For Docker, in the
config.settings.local
, add your host development server IP to
INTERNAL_IPS
or
ALLOWED_HOSTS
if the variable exists.
Activate a Docker Machine
This tells our computer that all future commands are specifically for
the dev1 machine. Using the
eval
command we can switch machines as
needed.:
$ eval "$(docker-machine env dev1)"
Debugging
ipdb
If you are using the following within your code to debug: :
import ipdb; ipdb.set_trace()
Then you may need to run the following for it to work as desired: :
$ docker-compose -f local.yml run --rm --service-ports django
django-debug-toolbar
In order for
django-debug-toolbar
to work designate your Docker Machine IP with
INTERNAL_IPS
in
local.py
.
docker logs
The
container_name
from the yml file can be used to check on
containers with docker commands, for example: :
$ docker logs worker
$ docker top worker