- Django 3 Web Development Cookbook
- Aidas Bendoraitis Jake Kronika
- 140字
- 2025-04-04 13:15:07
There's more...
You can destroy Docker containers with the docker-compose down command and rebuild them with your build script:
$ docker-compose down
$ ./build_dev.sh
If something is not working as expected, you can inspect the logs with the docker-compose logs command:
$ docker-compose logs nginx
$ docker-compose logs gunicorn
$ docker-compose logs db
To connect to any of the containers via SSH, you should use one of the following:
$ docker exec -it django_docker_gunicorn_1 bash
$ docker exec -it django_docker_nginx_1 bash
$ docker exec -it django_docker_db_1 bash
You can copy files and directories to and from volumes on Docker containers using the docker cp command:
$ docker cp ~/avatar.png django_docker_gunicorn_1:/home/myproject/media/
$ docker cp django_docker_gunicorn_1:/home/myproject/media ~/Desktop/
If you want to get better a understanding of Docker and Docker Compose, check out the official documentation at https://docs.docker.com/, and specifically https://docs.docker.com/compose/.