/root is read-only, so you can't run docker commands because you are not able to store the docker config (or any other files) generated by any authentication methods.
The solution is to run the docker commands as another user in order to save docker config properly.
Below are the steps to follow:
1) authenticate to Container Registry on a system where Cloud SDK is not available:
With an existing user (MYUSER):
sudo -u MYUSER docker-credential-gcr configure-docker
With a new generated user (NEWUSER):
sudo useradd -m NEWUSER
sudo -u NEWUSER docker-credential-gcr configure-docker
The -u flag executes the command as the specified user.
docker-credential-gcr configure-docker stores your credentials in your user home directory (an alternative to docker login). This way, you can use Docker's command-line tool to interact directly with Container Registry.
2) Create the docker group (if not exists) and add your user (required with NEWUSER or MYUSER with no permission to run Docker's commands):
sudo groupadd docker
sudo usermod -aG docker NEWUSER
3) If needed, restart the docker daemon:
sudo systemctl restart docker
In the end, you can access the docker images placed in your private container registry as MYUSER or NEWUSER. If you would like to run dockers:
sudo -u MYUSER docker run ........
The commands reported here work fine also in a startup-script and without the requirement of passwords.