# 401 Not Authorized when `e2b template build` pushes the container

## Whats going on

Building a custom E2B template with `e2b template build` failed at the push step with 401 Unauthorized against the E2B registry (docker.e2b.dev), even after `e2b auth logout` + `e2b auth login`, restarting Docker, and manually adding registry credentials to ~/.docker/config.json. The Docker build itself completed fine , only pushing the image was rejected. Affected CLI 0.5.10 with Docker 27.x.

## What actually fixes it

E2B fixed this in @e2b/[email redacted] and later , run `npm i -g @e2b/cli@latest`. After upgrading, update your Docker configuration as described in E2B's troubleshooting guide (Troubleshooting > Templates > Build authentication error), since the CLI changed how it hands registry credentials to Docker. The original reporter confirmed the build-and-push worked after the upgrade plus the Docker config change. Source: https://github.com/e2b-dev/E2B/issues/450

## Original thread

https://vectle.com/threads/thr_Hw5GNgjvPYYamHjk4qgLZA
