Creating a private repository for your image

We provide a private image registry you can push images to with each service. To make use of it you can start by creating a service and configuring it:

configure service

Note that we are leaving the Image empty, this will auto-populate the service with the provisioned registry. We are also setting Replicas to 0 to avoid starting the service and incurring costs before we have pushed the image.

Now you can click on Create:

create service

Now you can click on the newly created service:

click on the new service

And copy the image:

copy the image

Configuring docker to use Nhost’s registry

The CLI can configure docker automatically to be able to push and pull images from the docker registry. To do so you need to run the following command:

$ nhost docker-credentials configure

Installing credentials helper for docker in /usr/local/bin/docker-credential-nhost-login
I need root privileges to install the file. Please, enter your password.
- I am about to configure docker to authenticate with Nhost's registry. This will modify your docker config file on /Users/dbarroso/.docker/config.json. Should I continue? [y/N] y

After you have configured the credentials helper with the command above docker should be able to interact with your images normally:

$ docker buildx build \
    --push \
    --platform linux/amd64,linux/arm64 \
    -t \
[+] Building 8.7s (11/11) FINISHED                                                                                                                  docker-container:focused_dirac
 => [internal] load .dockerignore                                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                                               0.0s
 => [internal] load build definition from Dockerfile                                                                                                                          0.0s
 => => transferring dockerfile: 96B                                                                                                                                           0.0s
 => [linux/arm64 internal] load metadata for                                                                                                   6.4s
 => [linux/amd64 internal] load metadata for                                                                                                   6.4s
 => [linux/arm64 1/2] FROM                                             0.0s
 => => resolve                                                         0.0s
 => [internal] load build context                                                                                                                                             0.0s
 => => transferring context: 28B                                                                                                                                              0.0s
 => [linux/amd64 1/2] FROM                                             0.0s
 => => resolve                                                         0.0s
 => CACHED [linux/arm64 2/2] ADD app.js app.js                                                                                                                                0.0s
 => CACHED [linux/amd64 2/2] ADD app.js app.js                                                                                                                                0.0s
 => exporting to image                                                                                                                                                        2.2s
 => => exporting layers                                                                                                                                                       0.0s
 => => exporting manifest sha256:b38199ab8a25d3c765cd763be8af6ea6b3542455f2e7ad37f92924538dbc2af7                                                                             0.0s
 => => exporting config sha256:d66a5274b034a3b5698044a03bbec53dccc9e4f5f774701c59604fa17c8f0ff3                                                                               0.0s
 => => exporting attestation manifest sha256:c5487067b094ab1d7a81a216595a0f773c55ceec95319e844cded94247e4d341                                                                 0.0s
 => => exporting manifest sha256:f1c56d22755cae4d73ee432f11d248ca10ae4b89be3d56f0ffe95e5d7ce10542                                                                             0.0s
 => => exporting config sha256:a532f91c5f9899a150b9c981933fa3b163879dcb5ceb48ebc132f72b564a5878                                                                               0.0s
 => => exporting attestation manifest sha256:9e1a0207de26c335df4cee8398ada86f7b6a68ebb86e39550fe862416a10df84                                                                 0.0s
 => => exporting manifest list sha256:f0d8521804f16280642e99c8c25bbd66f659a9a9bd7bb72cf0726dd98d9bfb00                                                                        0.0s
 => => pushing layers                                                                                                                                                         1.2s
 => => pushing manifest for  1.0s
 => [auth] sharing credentials for                                                                                                            0.0s

The credentials helper will authenticate requests with the logged in user, so don’t forget to authenticate with your user before trying to push or pull images. You can log in by running the command nhost login.

Updating the image in the service configuration

After you have pushed your image you can click on your service again and update the configuration:

configure service

Notice we added the tag :123 to the image that was already pre-populated and that we increased replicas to 1 to unpause the service. Don’t forget to copy the URL where we are exposing the service. Now you can click on update:

update service

Wait a few seconds until the project is done updating the new service and visit the URL we copied before:

visit url