I'm working on google container optimised OS (COS) trying to pull an image from Google Container Registry using docker-compose. I completed the the authentication using docker-credential-gcr.
Now
docker pull gcr.io/projectname/nextjs
works
however
> docker-compose pull
Pulling nextjs ... error
ERROR: for nextjs unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials.
the problem was that the docker-compose alias did not support the gcr authentication.
The following steps fixed it.
Delete ~/.docker/config.json
change the alias in .bashrc to:
alias docker-compose='docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:$PWD" -w="$PWD" cryptopants/docker-compose-gcr'
docker pull cryptopants/docker-compose-gcr
docker-credential-gcr configure-docker
docker-compose pull works