# Dockerising wagtail projects in 5 minutes - Sævar Öfjörð Magnússon

Source: https://djangotv.com/videos/wagtail-space-nl/2022/dockerising-wagtail-projects-in-5-minutes-svar-ofjor-magnusson-wagtail-space-nl-2022/
Date: 2022-06-30
Speakers: Sævar Öfjörð Magnússon

## Summary

Sævar Öfjörð Magnússon explains how he built a template repository for starting Wagtail projects entirely in Docker. Wanting to keep his host computer free of Python and other project dependencies left him unable to create a normal project locally, so the template provides a Docker container in which he can create one. He clones the template, starts the container, opens a shell with `docker compose exec`, runs `wagtail start` and `manage.py migrate`, then restarts the container with the project’s normal process. The setup also lets users customize the port to avoid conflicts and leaves initial project creation under their control.

## Transcript

### [00:00] Dockerising Wagtail: Motivation and Template

[00:02] Originally I wanted to do a talk about how I would dock raise a an existing Wagtail project. The backstory is that like in January I got a new computer and we decided to move everything we had for clients. To Docker. So I want to maintain like a clean host computer without any libraries or Python stuff in it so I only use Docker to develop locally. So it turns out that I don't have an existing project on my computer like I couldn't create a base project on my computer because I don't have any of the dependencies.

[00:49] So it was a kind of a cat's twenty two. So I flipped it so I will show you how I created a small template repository which will allow you to create a Docker Doc Rest Wagtail project in you know a few minutes. But first, this is a mess mistake many rookies do. They don't have the proper attire when working with docs. So you know. Okay, now I'm ready. Yeah, so I created a small template repository which you can use to

### [01:36] Creating a Project from the Template

[01:36] generate a product project. So I'm going to use this template I'm going to create a my Wagtail site. That's available. Create the repository from template So now I have the repository. I can clone the repository locally. So I will open up a terminal. Can you see this? No. Yeah. Okay. So I'll go to something like Code git clone repository. So what I would do here is just Docker compose

### [02:21] Starting the Docker Container

[02:21] up Port already all located. Yeah, okay. So yeah, I run a lot of Dockers and some Sometimes they conflict. So I have this thing where I can customize the port. So what I do initially is I let the container run in kind of an infinite loop really. It's not doing anything at the moment because when you have an empty container, I didn't want to go the path of like doing everything for you in the beginning.

### [03:07] Initialising the Wagtail Site

[03:07] Because you want to control perhaps the name of your project and stuff like that. So I would just do a Docker compose exec Go into a shell and do a wagtail start my site in the current folder. I will I can do a manage migrate. So now I'm gonna stop the container again I'm going to switch it over to the correct process Run it again.

[03:58] So here it is. Thank you.
