The Raspberry Pi 400 has a 64-bit processor (armv8), but it comes with a 32-bit Raspbian kernel (armv7) pre-installed on the SD card. Because most Docker images support armv8 but not armv7, even if they’re built for multiple architectures, the best solution is to install a 64-bit Ubuntu kernel.
On a different computer, open Raspberry Pi Imager. Select "Ubuntu" and choose the latest version that's recommended for your Raspberry Pi. Choose your SD card as the target and write the image to the drive.
Important: if the Raspberry Pi will need to connect to a wifi network, edit the
network-config file and add the network's SSID and password now.
Then insert the SD card into your Raspberry Pi and start it up. You’ll need to wait a minute for it to finish generating the default user, then you can sign in with the default credentials (
ubuntu:ubuntu) and change the password.
Run the Docker CE for Linux installation script:
curl -fsSL https://get.docker.com -o get-docker.sh get-docker.sh
docker run --rm mongo to make sure it can fetch and start a service in Docker.