Docker Administration¶
This will go over how to administrate your container.
Basic Docker¶
To get things like <container_name> or other variables we may mention here, you’ll need to know some basic Docker.
docker container lsLists all containers. You’ll be able to get <container_name> from here.docker-compose upStarts up your containers from adocker-compose.yml. Run with-dto detach from terminal.docker-compose downStops your containers from adocker-compose.ymldocker-compose buildIf you’re using ourDockerfile, this will rebuild the image.docker-compose pullIf you’re using our image, this will update your images to the latest.
Creating Superuser Accounts¶
Superuser accounts have all Django permissions, and are optimal for your admin accounts.
docker container exec -it <container_name> python3 /opt/krypted/app/manage.py createsuperuser- Fill out the information as required
Running Django Commands¶
Some packages require you to run setup scripts or other Django commands.
docker container exec -it <container_name> python3 /opt/krypted/app/manage.py <command>
Database Backups¶
Backups are important, you should do them frequently and every time before you updgrade.
- Create a backup with
sudo docker-compose exec db sh -c 'exec mysqldump "$MYSQL_DATABASE" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" 2>/dev/null' | gzip > "`date +"%Y_%m_%d"`_krypted.sql.gz"
- Restore a backup with
zcat *krypted.sql.gz | docker-compose exec -T db sh -c 'exec mysql "$MYSQL_DATABASE" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"'