So I got Sitecore running in containers a couple of times now, while following slightly different instructions for the 10.0 and the 10.2 version of the docs. But, contrary to the name of one of the documents I followed, it didn’t really get a development environment set up. Now, I’m looking into what it takes to get set up for actual development.
To be honest, I’m not thrilled with what Sitecore has provided here. It should really be easier to get a development environment up and running. I realize that the docs are trying to teach you how things work so you can customize the setup to fit your specific needs, but that should really be an optional lesson, IMHO. There should really be a quick-start that gets you going with SXA, Headless Services and the watch script without making you get into the weeds of docker build files, compose files, volume mounts, etc.
As they are, the docs start you out with spinning up a bare-bones XP0 instance. Unlike previous versions of the docs, they have you use the container deployment package rather than the docker-examples repo for this. Then they jump straight into building custom images and going back to using the docker-examples repo. After going through rather advanced topics in this custom images section, it goes back to things that are more relevant to a developer just getting started: deploying files to running containers and syncing content. I think a more natural progression would be to present the local development topics, then adding Sitecore modules and finally adding in the solution build container and other CI/CD stuff.
I’m not going to try to rewrite Sitecore’s docs for them, but I did put together a repo that I think might be a bit more helpful to developers that are trying to get started or just want to quickly spin up a local dev environment: Sitecore Docker Development Quickstart. This repo offers samples of both XP0 and XM0 topologies that include SXA and Headless Services. They also include the watch script needed to support deploying files into the running containers via volume mounts. They do not contain the solution build container, but you can do a global find-replace to uncomment those parts if you wish. Of course, you would also need to add your solution and customize the root dockerfile to suit your needs.