Why am I receiving a "user does not exist" error when building my Docker app on App Platform?

If your Docker App on App Platform fails to build with the following error in the deployment logs, then the USER instruction may be in the wrong place in your Dockerfile:

error building image: error building stage: failed to execute command: identifying uid and gid for user app: user app is not a uid and does not exist on the system

In a Dockerfile, each instruction builds on the state created by the previous instructions. If the USER instruction is before a FROM or WORKDIR instruction, the FROM and WORKDIR instruction fail to execute because the user ID doesn’t exist in the base image or work directory yet.

To fix this, make sure the line with the USER instruction is after the lines with the FROM and WORKDIR instructions in your Dockerfile:

FROM example-image:latest AS base
WORKDIR /example/dir
USER example-user


After you update the Dockerfile in your repository, your Docker app automatically redeploys on App Platform.

Ensure your Dockerfile’s path is correctly defined using the dockerfile_path parameter in your app spec file.